# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 303
n 303(None)[self._update_received_task = Task(self._update_received)
self._async_media_update_task = Task(self._async_media_update)
self._async_media_update_task.delay = 0
self._async_media_update_task._considered_idle = True
self.async_media_update = self._async_media_update_task.start
return None
]:
	i: 220(), 282(), 302()
	o: 

nname: 302
n 302(None)[]:
	i: 242(f)
	o: 303()

nname: 282
n 282(None)[self.infos.update(meta_infos)
]:
	i: 242(t)
	o: 303()

nname: 242
n 242(meta_infos)[self.wymedia_resource = None
self.infos = dict(uri='unknown://void', duration=0)
]:
	i: 192(f)
	o: 282(t), 302(f)

nname: 220
n 220(None)[self.wymedia_resource = wymedia_resource
self.infos = None
]:
	i: 192(t)
	o: 303()

nname: 192
n 192(valid_wymedia_obj)[Item.__init__(self, name=name, type_=type_, menu=menu, display_type=display_type, parent=parent)
]:
	i: 164(t), 188()
	o: 220(t), 242(f)

nname: 188
n 188(None)[]:
	i: 164(f)
	o: 192()

nname: 164
n 164(type_)[]:
	i: 65(), 158()
	o: 188(f), 192(t)

nname: 158
n 158(None)[valid_wymedia_obj = True
]:
	i: 88(), 119(), 145()
	o: 164()

nname: 145
n 145(None)[name = _('Untitled')
]:
	i: 108(f)
	o: 158()

nname: 119
n 119(None)[name = wymedia_resource['title'].decode('utf-8', 'ignore')
]:
	i: 108(t)
	o: 158()

nname: 108
n 108(wymedia_resource['title'])[]:
	i: 75(f)
	o: 119(t), 145(f)

nname: 88
n 88(None)[name = _(wymedia_resource['title'])
]:
	i: 75(t)
	o: 158()

nname: 75
n 75('i18n' in wymedia_resource)[]:
	i: 50(f)
	o: 88(t), 108(f)

nname: 65
n 65(None)[name = wymedia_resource
]:
	i: 50(t)
	o: 164()

nname: 50
n 50(isinstance(wymedia_resource, basestring))[]:
	i: 39(), 49()
	o: 65(t), 75(f)

nname: 49
n 49(None)[]:
	i: 0(f)
	o: 50()

nname: 39
n 39(None)[wymedia_resource = 'Unnamed'
]:
	i: 0(t)
	o: 50()

nname: 0
n 0(wymedia_resource is None)[valid_wymedia_obj = False
self._observers = set()
self._metadata_handle = None
]:
	i: 
	o: 39(t), 49(f)

nname: 303
n 303(None)[self._update_received_task = Task(self._update_received)
self._async_media_update_task = Task(self._async_media_update)
self._async_media_update_task.delay = 0
self._async_media_update_task._considered_idle = True
self.async_media_update = self._async_media_update_task.start
return None
]:
	i: 164()
	o: 

nname: 164
n 164(None)[if not type_:
	pass
Item.__init__(self, name=name, type_=type_, menu=menu, display_type=display_type, parent=parent)
if valid_wymedia_obj:
	self.wymedia_resource = wymedia_resource
	self.infos = None
else:
	self.wymedia_resource = None
	self.infos = dict(uri='unknown://void', duration=0)
	if meta_infos:
		self.infos.update(meta_infos)
]:
	i: 65(), 75()
	o: 303()

nname: 75
n 75(None)[if 'i18n' in wymedia_resource:
	name = _(wymedia_resource['title'])
else:
	if wymedia_resource['title']:
		name = wymedia_resource['title'].decode('utf-8', 'ignore')
	else:
		name = _('Untitled')
valid_wymedia_obj = True
]:
	i: 0(f)
	o: 164()

nname: 65
n 65(None)[name = wymedia_resource
]:
	i: 0(t)
	o: 164()

nname: 0
n 0(isinstance(wymedia_resource, basestring))[valid_wymedia_obj = False
self._observers = set()
self._metadata_handle = None
if wymedia_resource is None:
	wymedia_resource = 'Unnamed'
]:
	i: 
	o: 65(t), 75(f)

nname: 303
n 303(None)[self._update_received_task = Task(self._update_received)
self._async_media_update_task = Task(self._async_media_update)
self._async_media_update_task.delay = 0
self._async_media_update_task._considered_idle = True
self.async_media_update = self._async_media_update_task.start
return None
]:
	i: 0()
	o: 

nname: 0
n 0(None)[valid_wymedia_obj = False
self._observers = set()
self._metadata_handle = None
if wymedia_resource is None:
	wymedia_resource = 'Unnamed'
if isinstance(wymedia_resource, basestring):
	name = wymedia_resource
else:
	if 'i18n' in wymedia_resource:
		name = _(wymedia_resource['title'])
	else:
		if wymedia_resource['title']:
			name = wymedia_resource['title'].decode('utf-8', 'ignore')
		else:
			name = _('Untitled')
	valid_wymedia_obj = True
if not type_:
	pass
Item.__init__(self, name=name, type_=type_, menu=menu, display_type=display_type, parent=parent)
if valid_wymedia_obj:
	self.wymedia_resource = wymedia_resource
	self.infos = None
else:
	self.wymedia_resource = None
	self.infos = dict(uri='unknown://void', duration=0)
	if meta_infos:
		self.infos.update(meta_infos)
]:
	i: 
	o: 303()

nname: 0
n 0(None)[valid_wymedia_obj = False
self._observers = set()
self._metadata_handle = None
if wymedia_resource is None:
	wymedia_resource = 'Unnamed'
if isinstance(wymedia_resource, basestring):
	name = wymedia_resource
else:
	if 'i18n' in wymedia_resource:
		name = _(wymedia_resource['title'])
	else:
		if wymedia_resource['title']:
			name = wymedia_resource['title'].decode('utf-8', 'ignore')
		else:
			name = _('Untitled')
	valid_wymedia_obj = True
if not type_:
	pass
Item.__init__(self, name=name, type_=type_, menu=menu, display_type=display_type, parent=parent)
if valid_wymedia_obj:
	self.wymedia_resource = wymedia_resource
	self.infos = None
else:
	self.wymedia_resource = None
	self.infos = dict(uri='unknown://void', duration=0)
	if meta_infos:
		self.infos.update(meta_infos)
self._update_received_task = Task(self._update_received)
self._async_media_update_task = Task(self._async_media_update)
self._async_media_update_task.delay = 0
self._async_media_update_task._considered_idle = True
self.async_media_update = self._async_media_update_task.start
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aea78c>}
nname: 80
n 80(None)[]:
	i: 9(), 66()
	o: 

nname: 66
n 66(None)[return Item.__repr__(self)
]:
	i: 0(f)
	o: 80()

nname: 9
n 9(None)[return '<%s::%s(%s):%s>' % (self.__class__.__name__, self.type, repr(self.name), self.wymedia_resource.get('id', 'unknown'))
]:
	i: 0(t)
	o: 80()

nname: 0
n 0(self.wymedia_resource)[]:
	i: 
	o: 9(t), 66(f)

nname: 0
n 0(None)[if self.wymedia_resource:
	return '<%s::%s(%s):%s>' % (self.__class__.__name__, self.type, repr(self.name), self.wymedia_resource.get('id', 'unknown'))
else:
	return Item.__repr__(self)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b9d0c>}
nname: 121
n 121(None)[return self._parent
]:
	i: 69(JA), 117(), 120()
	o: 

nname: 120
n 120(None)[]:
	i: 0(t)
	o: 121()

nname: 117
n 117(None)[]:
	i: 53(JA), 116()
	o: 121()

nname: 116
n 116(None)[]:
	i: 9&19(f)
	o: 117()

nname: 69
n 69(None)[wm_parent = get_object(self['parentid'], ('uri', 'class', 'title'))
self._parent = get_mmi_object(wm_parent, self.menu, None)
]:
	i: 30(f)
	o: 121(JA)

nname: 53
n 53(None)[self._parent = RootItem()
]:
	i: 30(t)
	o: 117(JA)

nname: 30
n 30(int(self['parentid']) == 0)[]:
	i: 9&19(t)
	o: 53(t), 69(f)

nname: 9&19
n 9&19(self.wymedia_resource and self['parentid'])[]:
	i: 0(f)
	o: 30(t), 116(f)

nname: 0
n 0(self._parent)[]:
	i: 
	o: 9&19(f), 120(t)

nname: 121
n 121(None)[return self._parent
]:
	i: 69(JA), 53(JA), 9&19(f), 0(t)
	o: 

nname: 69
n 69(None)[wm_parent = get_object(self['parentid'], ('uri', 'class', 'title'))
self._parent = get_mmi_object(wm_parent, self.menu, None)
]:
	i: 30(f)
	o: 121(JA)

nname: 53
n 53(None)[self._parent = RootItem()
]:
	i: 30(t)
	o: 121(JA)

nname: 30
n 30(int(self['parentid']) == 0)[]:
	i: 9&19(t)
	o: 53(t), 69(f)

nname: 9&19
n 9&19(self.wymedia_resource and self['parentid'])[]:
	i: 0(f)
	o: 30(t), 121(f)

nname: 0
n 0(self._parent)[]:
	i: 
	o: 9&19(f), 121(t)

nname: 0
n 0(None)[if not self._parent:
	if self.wymedia_resource and self['parentid']:
		if int(self['parentid']) == 0:
			self._parent = RootItem()
		else:
			wm_parent = get_object(self['parentid'], ('uri', 'class', 'title'))
			self._parent = get_mmi_object(wm_parent, self.menu, None)
return self._parent
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aeae8c>}
nname: 0
n 0(None)[self._parent = item
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aea6cc>}
nname: 52
n 52(None)[]:
	i: 3(), 39(), 50(AE)
	o: 

nname: 50
n 50(None)[]:
	i: 29(f)
	o: 52(AE)

nname: 39
n 39(None)[return False
]:
	i: 29(t)
	o: 52()

nname: 29
n 29(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 0(except)
	o: 39(t), 50(f)

nname: 3
n 3(None)[return bool(self.wymedia_resource.get('marked'))
]:
	i: 0(try)
	o: 52()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 29(except)

nname: 29
n 29(None)[except AttributeError:
	return False
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	return bool(self.wymedia_resource.get('marked'))
]:
	i: 
	o: 29()

nname: 0
n 0(None)[try:
	return bool(self.wymedia_resource.get('marked'))
except AttributeError:
	return False
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aeaccc>}
nname: 213
n 213(None)[log.debug('RES: %s', self.wymedia_resource)
]:
	i: 80(JA), 94(JA), 127(), 130(AL), 212()
	o: 

nname: 212
n 212(None)[]:
	i: 134(AF), 209()
	o: 213()

nname: 209
n 209(None)[]:
	i: 173(AE)
	o: 212()

nname: 173
n 173(None)[log.debug('setting %s[%s]=%s Failed', self, key, value)
PRINT_EXCEPTION()
continue
]:
	i: 147(except), 159()
	o: 209(AE)

nname: 159
n 159(None)[self[key] = value
continue
]:
	i: 147(try)
	o: 173()

nname: 147
n 147(None)[for key, value in kw.iteritems():
]:
	i: 134(for)
	o: 159(try), 173(except)

nname: 134
n 134(None)[]:
	i: 130(loop)
	o: 147(for), 212(AF)

nname: 130
n 130(None)[]:
	i: 37(f)
	o: 134(loop), 213(AL)

nname: 94
n 94(None)[log.error('set_metadata %s on %s failed!', kw, self)
PRINT_EXCEPTION()
]:
	i: 43(except)
	o: 213(JA)

nname: 80
n 80(None)[set_metadata(kw)
]:
	i: 43(try)
	o: 213(JA)

nname: 43
n 43(None)[self.wymedia_resource.update(kw)
kw['id'] = self.wymedia_resource['refid']
]:
	i: 37(t)
	o: 80(try), 94(except)

nname: 37
n 37(_unref_link)[]:
	i: 28(), 36()
	o: 43(t), 130(f)

nname: 36
n 36(None)[]:
	i: 0(t)
	o: 37()

nname: 28
n 28(None)[]:
	i: 0(f)
	o: 37()

nname: 0
n 0(self.wymedia_resource)[log.debug('Setting %s to %s', kw, self)
]:
	i: 
	o: 28(f), 36(t)

nname: 213
n 213(None)[log.debug('RES: %s', self.wymedia_resource)
]:
	i: 94(JA), 127(), 130(AL), 134(AF), 173(AE)
	o: 

nname: 173
n 173(None)[except:
	log.debug('setting %s[%s]=%s Failed', self, key, value)
	PRINT_EXCEPTION()
	continue
]:
	i: 147()
	o: 213(AE)

nname: 147
n 147(None)[for key, value in kw.iteritems():
try:
	self[key] = value
	continue
]:
	i: 134(for)
	o: 173()

nname: 134
n 134(None)[]:
	i: 130(loop)
	o: 147(for), 213(AF)

nname: 130
n 130(None)[]:
	i: 0(f)
	o: 134(loop), 213(AL)

nname: 94
n 94(None)[except:
	log.error('set_metadata %s on %s failed!', kw, self)
	PRINT_EXCEPTION()
]:
	i: 43()
	o: 213(JA)

nname: 43
n 43(None)[self.wymedia_resource.update(kw)
kw['id'] = self.wymedia_resource['refid']
try:
	set_metadata(kw)
]:
	i: 0(t)
	o: 94()

nname: 0
n 0(_unref_link)[log.debug('Setting %s to %s', kw, self)
if not self.wymedia_resource:
	pass
]:
	i: 
	o: 43(t), 130(f)

nname: 213
n 213(None)[log.debug('RES: %s', self.wymedia_resource)
]:
	i: 43(JA), 127(), 130(AL), 134(AF), 147(AE)
	o: 

nname: 147
n 147(None)[for key, value in kw.iteritems():
try:
	self[key] = value
	continue
except:
	log.debug('setting %s[%s]=%s Failed', self, key, value)
	PRINT_EXCEPTION()
	continue
]:
	i: 134(for)
	o: 213(AE)

nname: 134
n 134(None)[]:
	i: 130(loop)
	o: 147(for), 213(AF)

nname: 130
n 130(None)[]:
	i: 0(f)
	o: 134(loop), 213(AL)

nname: 43
n 43(None)[self.wymedia_resource.update(kw)
kw['id'] = self.wymedia_resource['refid']
try:
	set_metadata(kw)
except:
	log.error('set_metadata %s on %s failed!', kw, self)
	PRINT_EXCEPTION()
]:
	i: 0(t)
	o: 213(JA)

nname: 0
n 0(_unref_link)[log.debug('Setting %s to %s', kw, self)
if not self.wymedia_resource:
	pass
]:
	i: 
	o: 43(t), 130(f)

nname: 213
n 213(None)[log.debug('RES: %s', self.wymedia_resource)
]:
	i: 43(JA), 127(), 147(AE)
	o: 

nname: 147
n 147(None)[for key, value in kw.iteritems():
	try:
		self[key] = value
		continue
	except:
		log.debug('setting %s[%s]=%s Failed', self, key, value)
		PRINT_EXCEPTION()
		continue
]:
	i: 130(for)
	o: 213(AE)

nname: 130
n 130(None)[]:
	i: 0(f)
	o: 147(for)

nname: 43
n 43(None)[self.wymedia_resource.update(kw)
kw['id'] = self.wymedia_resource['refid']
try:
	set_metadata(kw)
except:
	log.error('set_metadata %s on %s failed!', kw, self)
	PRINT_EXCEPTION()
]:
	i: 0(t)
	o: 213(JA)

nname: 0
n 0(_unref_link)[log.debug('Setting %s to %s', kw, self)
if not self.wymedia_resource:
	pass
]:
	i: 
	o: 43(t), 130(f)

nname: 213
n 213(None)[log.debug('RES: %s', self.wymedia_resource)
]:
	i: 43(JA), 127(), 130(AE)
	o: 

nname: 130
n 130(None)[for key, value in kw.iteritems():
	try:
		self[key] = value
		continue
	except:
		log.debug('setting %s[%s]=%s Failed', self, key, value)
		PRINT_EXCEPTION()
		continue
]:
	i: 0(f)
	o: 213(AE)

nname: 43
n 43(None)[self.wymedia_resource.update(kw)
kw['id'] = self.wymedia_resource['refid']
try:
	set_metadata(kw)
except:
	log.error('set_metadata %s on %s failed!', kw, self)
	PRINT_EXCEPTION()
]:
	i: 0(t)
	o: 213(JA)

nname: 0
n 0(_unref_link)[log.debug('Setting %s to %s', kw, self)
if not self.wymedia_resource:
	pass
]:
	i: 
	o: 43(t), 130(f)

nname: 213
n 213(None)[log.debug('RES: %s', self.wymedia_resource)
]:
	i: 0(JA), 127()
	o: 

nname: 0
n 0(None)[log.debug('Setting %s to %s', kw, self)
if not self.wymedia_resource:
	pass
if _unref_link:
	self.wymedia_resource.update(kw)
	kw['id'] = self.wymedia_resource['refid']
	try:
		set_metadata(kw)
	except:
		log.error('set_metadata %s on %s failed!', kw, self)
		PRINT_EXCEPTION()
else:
	for key, value in kw.iteritems():
		try:
			self[key] = value
			continue
		except:
			log.debug('setting %s[%s]=%s Failed', self, key, value)
			PRINT_EXCEPTION()
			continue
]:
	i: 
	o: 213(JA)

self.nodes: {0: <unpyclib.structure.node instance at 0xb75cb18c>, 126: <unpyclib.structure.node instance at 0xb75b9bac>, 213: <unpyclib.structure.node instance at 0xb75b9f2c>, 127: <unpyclib.structure.node instance at 0xb75b9bec>}
nname: 0
n 0(None)[self['title'] = new_name.encode('utf-8')
self.name = new_name
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aeaf8c>}
nname: 0
n 0(None)[object_remove(self.wymedia_resource, {'universe': self.universe})
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aeae0c>}
nname: 0
n 0(None)[self._update_received_task.args = args
self._update_received_task.start(0, consider_idle=True)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aea72c>}
nname: 65
n 65(None)[return None
]:
	i: 34(), 64()
	o: 

nname: 64
n 64(None)[]:
	i: 0(f)
	o: 65()

nname: 34
n 34(None)[self._observers.add(observer)
self.async_media_update()
]:
	i: 0(t)
	o: 65()

nname: 0
n 0(self.wymedia_resource is not None)[log.info('%s by %s', self, observer)
]:
	i: 
	o: 34(t), 64(f)

nname: 0
n 0(None)[log.info('%s by %s', self, observer)
if self.wymedia_resource is not None:
	self._observers.add(observer)
	self.async_media_update()
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aea9cc>}
nname: 127
n 127(None)[return None
]:
	i: 89(JA), 122(), 126()
	o: 

nname: 126
n 126(None)[]:
	i: 0(f)
	o: 127()

nname: 122
n 122(None)[]:
	i: 80(t)
	o: 127()

nname: 89
n 89(None)[log.info('unregister %s', self)
unregister_update_callback(self.wymedia_resource)
]:
	i: 80(f)
	o: 127(JA)

nname: 80
n 80(self._observers)[]:
	i: 47(), 63()
	o: 89(f), 122(t)

nname: 63
n 63(None)[self._observers.discard(observer)
]:
	i: 34(f)
	o: 80()

nname: 47
n 47(None)[self._observers = set()
]:
	i: 34(t)
	o: 80()

nname: 34
n 34(observer is None)[]:
	i: 0(t)
	o: 47(t), 63(f)

nname: 0
n 0(self.wymedia_resource is not None)[log.info('%s by %s', self, observer)
]:
	i: 
	o: 34(t), 126(f)

nname: 127
n 127(None)[return None
]:
	i: 34(JA), 0(f)
	o: 

nname: 34
n 34(None)[if observer is None:
	self._observers = set()
else:
	self._observers.discard(observer)
if not self._observers:
	log.info('unregister %s', self)
	unregister_update_callback(self.wymedia_resource)
]:
	i: 0(t)
	o: 127(JA)

nname: 0
n 0(self.wymedia_resource is not None)[log.info('%s by %s', self, observer)
]:
	i: 
	o: 34(t), 127(f)

nname: 0
n 0(None)[log.info('%s by %s', self, observer)
if self.wymedia_resource is not None:
	if observer is None:
		self._observers = set()
	else:
		self._observers.discard(observer)
	if not self._observers:
		log.info('unregister %s', self)
		unregister_update_callback(self.wymedia_resource)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aea86c>}
nname: 0
n 0(None)[return bool(self._observers)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aea64c>}
nname: 0
n 0(None)[return bool(self._observers)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aeaf8c>}
nname: 85
n 85(None)[return None
]:
	i: 26(), 84()
	o: 

nname: 84
n 84(None)[]:
	i: 0&15(f)
	o: 85()

nname: 26
n 26(None)[log.info(self)
register_update_callback(self.wymedia_resource, self.handle_update)
get_metadata(self.wymedia_resource)
self._metadata_handle = True
]:
	i: 0&15(t)
	o: 85()

nname: 0&15
n 0&15(self.wymedia_resource is not None and not self._metadata_handle)[]:
	i: 
	o: 26(t), 84(f)

nname: 0&15
n 0&15(None)[if self.wymedia_resource is not None and not self._metadata_handle:
	log.info(self)
	register_update_callback(self.wymedia_resource, self.handle_update)
	get_metadata(self.wymedia_resource)
	self._metadata_handle = True
return None
]:
	i: 
	o: 

self.nodes: {'0&15': <unpyclib.structure.node instance at 0x8aea7ac>}
nname: 180
n 180(None)[]:
	i: 162(), 166(), 179(AE)
	o: 

nname: 166
n 166(None)[PRINT_EXCEPTION()
]:
	i: 0(except)
	o: 180()

nname: 162
n 162(None)[]:
	i: 110(AL), 161()
	o: 180()

nname: 161
n 161(None)[]:
	i: 129(AF), 145()
	o: 162()

nname: 145
n 145(None)[for observer in list(self._observers):
observer(self)
]:
	i: 129(for)
	o: 161()

nname: 129
n 129(None)[]:
	i: 110(loop)
	o: 145(for), 161(AF)

nname: 110
n 110(None)[self.wymedia_resource.update(infos)
]:
	i: 60(JA), 83(), 109()
	o: 129(loop), 162(AL)

nname: 109
n 109(None)[]:
	i: 35(f)
	o: 110()

nname: 83
n 83(None)[self.name = infos['title'].decode('utf-8')
]:
	i: 47(f)
	o: 110()

nname: 60
n 60(None)[self.name = _(infos['title'])
]:
	i: 47(t)
	o: 110(JA)

nname: 47
n 47('i18n' in infos)[]:
	i: 35(t)
	o: 60(t), 83(f)

nname: 35
n 35('title' in infos)[]:
	i: 0(try)
	o: 47(t), 109(f)

nname: 0
n 0(None)[log.info(self)
log.debug('%s infos=%s', self, infos)
]:
	i: 
	o: 35(try), 166(except)

nname: 180
n 180(None)[]:
	i: 161(), 166(), 179(AE)
	o: 

nname: 166
n 166(None)[except:
	PRINT_EXCEPTION()
]:
	i: 0(except)
	o: 180()

nname: 161
n 161(None)[]:
	i: 129()
	o: 180()

nname: 129
n 129(None)[for observer in list(self._observers):
	observer(self)
]:
	i: 35(loop)
	o: 161()

nname: 35
n 35(None)[if 'title' in infos:
	if 'i18n' in infos:
		self.name = _(infos['title'])
	else:
		self.name = infos['title'].decode('utf-8')
self.wymedia_resource.update(infos)
]:
	i: 0(try)
	o: 129(loop)

nname: 0
n 0(None)[log.info(self)
log.debug('%s infos=%s', self, infos)
]:
	i: 
	o: 35(try), 166(except)

nname: 180
n 180(None)[]:
	i: 129(), 166()
	o: 

nname: 166
n 166(None)[except:
	PRINT_EXCEPTION()
]:
	i: 0()
	o: 180()

nname: 129
n 129(None)[for observer in list(self._observers):
	observer(self)
]:
	i: 0(loop)
	o: 180()

nname: 0
n 0(None)[log.info(self)
log.debug('%s infos=%s', self, infos)
try:
	if 'title' in infos:
		if 'i18n' in infos:
			self.name = _(infos['title'])
		else:
			self.name = infos['title'].decode('utf-8')
	self.wymedia_resource.update(infos)
]:
	i: 
	o: 129(loop), 166()

self.nodes: {0: <unpyclib.structure.node instance at 0x8aeaecc>, 129: <unpyclib.structure.node instance at 0x8aead4c>, 166: <unpyclib.structure.node instance at 0xb75cbe2c>, 180: <unpyclib.structure.node instance at 0xb75cbd0c>}
nname: 248
n 248(None)[return None
]:
	i: 239(JA), 244(), 247()
	o: 

nname: 247
n 247(None)[]:
	i: 0(f)
	o: 248()

nname: 244
n 244(None)[]:
	i: 220(JA), 243()
	o: 248()

nname: 243
n 243(None)[]:
	i: 42(f)
	o: 244()

nname: 239
n 239(None)[]:
	i: 51(f)
	o: 248(JA)

nname: 220
n 220(None)[self.wymedia_resource.update(wm_resource)
]:
	i: 205(), 219()
	o: 244(JA)

nname: 219
n 219(None)[]:
	i: 172(f)
	o: 220()

nname: 205
n 205(None)[wm_resource['index'] = index
]:
	i: 172(t)
	o: 220()

nname: 172
n 172(index is not None)[index = self.wymedia_resource.get('index', None)
]:
	i: 122(JA), 145(), 171()
	o: 205(t), 219(f)

nname: 171
n 171(None)[]:
	i: 96(f)
	o: 172()

nname: 145
n 145(None)[self.name = wm_resource['title'].decode('utf-8')
]:
	i: 109(f)
	o: 172()

nname: 122
n 122(None)[self.name = _(wm_resource['title'])
]:
	i: 109(t)
	o: 172(JA)

nname: 109
n 109('i18n' in wm_resource)[]:
	i: 96(t)
	o: 122(t), 145(f)

nname: 96
n 96('title' in wm_resource)[]:
	i: 51(t)
	o: 109(t), 171(f)

nname: 51
n 51(wm_resource)[log.debug('%s %s', self, wanted_attr)
wm_resource = get_object(self['id'], wanted_attr)
]:
	i: 42(t)
	o: 96(t), 239(f)

nname: 42
n 42(wanted_attr)[wanted_attr = names
]:
	i: 15&28(t), 38()
	o: 51(t), 243(f)

nname: 38
n 38(None)[]:
	i: 15&28(f)
	o: 42()

nname: 15&28
n 15&28(names or self.media_update_fields)[wm_resource = None
]:
	i: 0(t)
	o: 38(f), 42(t)

nname: 0
n 0(self.wymedia_resource is not None)[]:
	i: 
	o: 15&28(t), 247(f)

nname: 248
n 248(None)[return None
]:
	i: 51(f), 220(JA), 15&28(f), 0(f)
	o: 

nname: 220
n 220(None)[self.wymedia_resource.update(wm_resource)
]:
	i: 96()
	o: 248(JA)

nname: 96
n 96(None)[if 'title' in wm_resource:
	if 'i18n' in wm_resource:
		self.name = _(wm_resource['title'])
	else:
		self.name = wm_resource['title'].decode('utf-8')
index = self.wymedia_resource.get('index', None)
if index is not None:
	wm_resource['index'] = index
]:
	i: 51(t)
	o: 220()

nname: 51
n 51(wm_resource)[log.debug('%s %s', self, wanted_attr)
wm_resource = get_object(self['id'], wanted_attr)
]:
	i: 15&28(t)
	o: 96(t), 248(f)

nname: 15&28
n 15&28(wanted_attr)[wm_resource = None
if not(names or self.media_update_fields):
	pass
wanted_attr = names
]:
	i: 0(t)
	o: 51(t), 248(f)

nname: 0
n 0(self.wymedia_resource is not None)[]:
	i: 
	o: 15&28(t), 248(f)

nname: 248
n 248(None)[return None
]:
	i: 51(f), 96(JA), 15&28(f), 0(f)
	o: 

nname: 96
n 96(None)[if 'title' in wm_resource:
	if 'i18n' in wm_resource:
		self.name = _(wm_resource['title'])
	else:
		self.name = wm_resource['title'].decode('utf-8')
index = self.wymedia_resource.get('index', None)
if index is not None:
	wm_resource['index'] = index
self.wymedia_resource.update(wm_resource)
]:
	i: 51(t)
	o: 248(JA)

nname: 51
n 51(wm_resource)[log.debug('%s %s', self, wanted_attr)
wm_resource = get_object(self['id'], wanted_attr)
]:
	i: 15&28(t)
	o: 96(t), 248(f)

nname: 15&28
n 15&28(wanted_attr)[wm_resource = None
if not(names or self.media_update_fields):
	pass
wanted_attr = names
]:
	i: 0(t)
	o: 51(t), 248(f)

nname: 0
n 0(self.wymedia_resource is not None)[]:
	i: 
	o: 15&28(t), 248(f)

nname: 0
n 0(None)[if self.wymedia_resource is not None:
	wm_resource = None
	if not(names or self.media_update_fields):
		pass
	wanted_attr = names
	if wanted_attr:
		log.debug('%s %s', self, wanted_attr)
		wm_resource = get_object(self['id'], wanted_attr)
		if wm_resource:
			if 'title' in wm_resource:
				if 'i18n' in wm_resource:
					self.name = _(wm_resource['title'])
				else:
					self.name = wm_resource['title'].decode('utf-8')
			index = self.wymedia_resource.get('index', None)
			if index is not None:
				wm_resource['index'] = index
			self.wymedia_resource.update(wm_resource)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b9e2c>}
nname: 330
n 330(None)[return None
]:
	i: 288(), 302(), 328(AE)
	o: 

nname: 328
n 328(None)[]:
	i: 292(f)
	o: 330(AE)

nname: 302
n 302(None)[log.error('No such key: %s[%s]', self, name)
]:
	i: 292(t)
	o: 330()

nname: 292
n 292(<dummy_ex3> EXC_MATCH Exception)[]:
	i: 0(except)
	o: 302(t), 328(f)

nname: 288
n 288(None)[]:
	i: 203(JA), 220(), 284()
	o: 330()

nname: 284
n 284(None)[return res
]:
	i: 259(), 283()
	o: 288()

nname: 283
n 283(None)[]:
	i: 228(f)
	o: 284()

nname: 259
n 259(None)[res, self.infos[name] = res(), res()
]:
	i: 228(t)
	o: 284()

nname: 228
n 228(callable(res))[res = self.infos.get(name)
]:
	i: 3(f)
	o: 259(t), 283(f)

nname: 220
n 220(None)[return data
]:
	i: 178(f)
	o: 288()

nname: 203
n 203(None)[return data.decode('utf-8')
]:
	i: 178(t)
	o: 288(JA)

nname: 178
n 178(name in UNICODE_METADATA_FIELDS)[data = self.wymedia_resource[name]
]:
	i: 31(), 170(), 177()
	o: 203(t), 220(f)

nname: 177
n 177(None)[]:
	i: 69(f)
	o: 178()

nname: 170
n 170(None)[return tn
]:
	i: 132(JA), 155(), 169()
	o: 178()

nname: 169
n 169(None)[]:
	i: 82(f)
	o: 170()

nname: 155
n 155(None)[self.async_media_update()
]:
	i: 113(f)
	o: 170()

nname: 132
n 132(None)[self.watch(self.menu._thumbnail_updated)
]:
	i: 113(t)
	o: 170(JA)

nname: 113
n 113(hasattr(self.menu, '_thumbnail_updated'))[]:
	i: 82(t)
	o: 132(t), 155(f)

nname: 82
n 82(tn is None)[tn = self.wymedia_resource.get('preview')
]:
	i: 69(t)
	o: 113(t), 169(f)

nname: 69
n 69(name == 'thumbnail')[]:
	i: 18(f)
	o: 82(t), 177(f)

nname: 31
n 31(None)[return list(WMedia2MMIObjects(get_subtitles(self.wymedia_resource), self.menu, self))
]:
	i: 18(t)
	o: 178()

nname: 18
n 18(name == 'subtitles')[]:
	i: 3(t)
	o: 31(t), 69(f)

nname: 3
n 3(self.wymedia_resource is not None)[]:
	i: 0(try)
	o: 18(t), 228(f)

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 292(except)

nname: 330
n 330(None)[return None
]:
	i: 292(), 178(JA), 228()
	o: 

nname: 292
n 292(None)[except Exception:
	log.error('No such key: %s[%s]', self, name)
]:
	i: 0()
	o: 330()

nname: 228
n 228(None)[res = self.infos.get(name)
if callable(res):
	res, self.infos[name] = res(), res()
return res
]:
	i: 0(f)
	o: 330()

nname: 178
n 178(None)[data = self.wymedia_resource[name]
if name in UNICODE_METADATA_FIELDS:
	return data.decode('utf-8')
else:
	return data
]:
	i: 31(), 82(), 69(f)
	o: 330(JA)

nname: 82
n 82(None)[tn = self.wymedia_resource.get('preview')
if tn is None:
	if hasattr(self.menu, '_thumbnail_updated'):
		self.watch(self.menu._thumbnail_updated)
	else:
		self.async_media_update()
return tn
]:
	i: 69(t)
	o: 178()

nname: 69
n 69(name == 'thumbnail')[]:
	i: 18(f)
	o: 82(t), 178(f)

nname: 31
n 31(None)[return list(WMedia2MMIObjects(get_subtitles(self.wymedia_resource), self.menu, self))
]:
	i: 18(t)
	o: 178()

nname: 18
n 18(name == 'subtitles')[]:
	i: 0(t)
	o: 31(t), 69(f)

nname: 0
n 0(self.wymedia_resource is not None)[try:
	pass
]:
	i: 
	o: 18(t), 228(f), 292()

nname: 330
n 330(None)[return None
]:
	i: 292(), 18(JA), 228()
	o: 

nname: 292
n 292(None)[except Exception:
	log.error('No such key: %s[%s]', self, name)
]:
	i: 0()
	o: 330()

nname: 228
n 228(None)[res = self.infos.get(name)
if callable(res):
	res, self.infos[name] = res(), res()
return res
]:
	i: 0(f)
	o: 330()

nname: 18
n 18(None)[if name == 'subtitles':
	return list(WMedia2MMIObjects(get_subtitles(self.wymedia_resource), self.menu, self))
else:
	if name == 'thumbnail':
		tn = self.wymedia_resource.get('preview')
		if tn is None:
			if hasattr(self.menu, '_thumbnail_updated'):
				self.watch(self.menu._thumbnail_updated)
			else:
				self.async_media_update()
		return tn
data = self.wymedia_resource[name]
if name in UNICODE_METADATA_FIELDS:
	return data.decode('utf-8')
else:
	return data
]:
	i: 0(t)
	o: 330(JA)

nname: 0
n 0(self.wymedia_resource is not None)[try:
	pass
]:
	i: 
	o: 18(t), 228(f), 292()

nname: 330
n 330(None)[return None
]:
	i: 292(), 0(JA)
	o: 

nname: 0
n 0(None)[try:
	pass
if self.wymedia_resource is not None:
	if name == 'subtitles':
		return list(WMedia2MMIObjects(get_subtitles(self.wymedia_resource), self.menu, self))
	else:
		if name == 'thumbnail':
			tn = self.wymedia_resource.get('preview')
			if tn is None:
				if hasattr(self.menu, '_thumbnail_updated'):
					self.watch(self.menu._thumbnail_updated)
				else:
					self.async_media_update()
			return tn
	data = self.wymedia_resource[name]
	if name in UNICODE_METADATA_FIELDS:
		return data.decode('utf-8')
	else:
		return data
else:
	res = self.infos.get(name)
	if callable(res):
		res, self.infos[name] = res(), res()
	return res
]:
	i: 
	o: 330(JA)

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b9a0c>, 292: <unpyclib.structure.node instance at 0xb75b69cc>, 330: <unpyclib.structure.node instance at 0xb75cba4c>}
nname: 127
n 127(None)[return None
]:
	i: 28(JA), 109(), 113()
	o: 

nname: 113
n 113(None)[self.infos[name] = value
]:
	i: 0(f)
	o: 127()

nname: 109
n 109(None)[]:
	i: 15(f)
	o: 127()

nname: 28
n 28(None)[self.wymedia_resource[name] = value
log.debug('wymedia.set_metadata(id: %s  %s: %s)', self.wymedia_resource['id'], name, value)
set_metadata({'id': self.wymedia_resource['id'], name: value})
]:
	i: 15(t)
	o: 127(JA)

nname: 15
n 15(name not in ('subtitles', 'thumbnail', 'preview'))[]:
	i: 0(t)
	o: 28(t), 109(f)

nname: 0
n 0(self.wymedia_resource is not None)[]:
	i: 
	o: 15(t), 113(f)

nname: 0
n 0(None)[if self.wymedia_resource is not None:
	if name not in ('subtitles', 'thumbnail', 'preview'):
		self.wymedia_resource[name] = value
		log.debug('wymedia.set_metadata(id: %s  %s: %s)', self.wymedia_resource['id'], name, value)
		set_metadata({'id': self.wymedia_resource['id'], name: value})
else:
	self.infos[name] = value
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aea36c>}
nname: 60
n 60(None)[]:
	i: 3(), 39(), 58(AE)
	o: 

nname: 58
n 58(None)[]:
	i: 29(f)
	o: 60(AE)

nname: 39
n 39(None)[#, e
PRINT_EXCEPTION(e)
]:
	i: 29(t)
	o: 60()

nname: 29
n 29(<dummy_ex3> EXC_MATCH Exception)[]:
	i: 0(except)
	o: 39(t), 58(f)

nname: 3
n 3(None)[self.player.play(self, *args, **kw)
]:
	i: 0(try)
	o: 60()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 29(except)

nname: 29
n 29(None)[except Exception, e:
	PRINT_EXCEPTION(e)
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	self.player.play(self, *args, **kw)
]:
	i: 
	o: 29()

nname: 0
n 0(None)[try:
	self.player.play(self, *args, **kw)
except Exception, e:
	PRINT_EXCEPTION(e)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aea9cc>}
nname: 48
n 48(None)[return hash(self.wymedia_resource['id'])
]:
	i: 15(), 47()
	o: 

nname: 47
n 47(None)[]:
	i: 0(f)
	o: 48()

nname: 15
n 15(None)[return hash(self.name + self.type + self['uri'])
]:
	i: 0(t)
	o: 48()

nname: 0
n 0(self.wymedia_resource is None)[]:
	i: 
	o: 15(t), 47(f)

nname: 0
n 0(None)[if self.wymedia_resource is None:
	return hash(self.name + self.type + self['uri'])
return hash(self.wymedia_resource['id'])
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aea1ac>}
nname: 164
n 164(None)[return None
]:
	i: 82(), 138(), 163()
	o: 

nname: 163
n 163(None)[]:
	i: 109&125(f)
	o: 164()

nname: 138
n 138(None)[return self.wymedia_resource['id'] == other['id']
]:
	i: 109&125(t)
	o: 164()

nname: 109&125
n 109&125(isinstance(other, dict) and 'id' in other)[]:
	i: 0(f)
	o: 138(t), 163(f)

nname: 82
n 82(None)[return self.wymedia_resource['id'] == other.wymedia_resource['id']
]:
	i: 47(), 81()
	o: 164()

nname: 81
n 81(None)[]:
	i: 15&31(f)
	o: 82()

nname: 47
n 47(None)[return self.name + self.type == other.name + other.type
]:
	i: 15&31(t)
	o: 82()

nname: 15&31
n 15&31(self.wymedia_resource is None or other.wymedia_resource is None)[]:
	i: 0(t)
	o: 47(t), 81(f)

nname: 0
n 0(hasattr(other, 'wymedia_resource'))[]:
	i: 
	o: 15&31(t), 109&125(f)

nname: 164
n 164(None)[return None
]:
	i: 15&31(), 109&125()
	o: 

nname: 109&125
n 109&125(None)[if isinstance(other, dict) and 'id' in other:
	return self.wymedia_resource['id'] == other['id']
]:
	i: 0(f)
	o: 164()

nname: 15&31
n 15&31(None)[if self.wymedia_resource is None or other.wymedia_resource is None:
	return self.name + self.type == other.name + other.type
return self.wymedia_resource['id'] == other.wymedia_resource['id']
]:
	i: 0(t)
	o: 164()

nname: 0
n 0(hasattr(other, 'wymedia_resource'))[]:
	i: 
	o: 15&31(t), 109&125(f)

nname: 0
n 0(None)[if hasattr(other, 'wymedia_resource'):
	if self.wymedia_resource is None or other.wymedia_resource is None:
		return self.name + self.type == other.name + other.type
	return self.wymedia_resource['id'] == other.wymedia_resource['id']
else:
	if isinstance(other, dict) and 'id' in other:
		return self.wymedia_resource['id'] == other['id']
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aea2ec>}
nname: 0
n 0(None)[return not self == other
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aea34c>}
nname: 198
n 198(None)[return None
]:
	i: 85(), 144(), 172()
	o: 

nname: 172
n 172(None)[return cmp(type(self), type(other))
]:
	i: 115&131(f)
	o: 198()

nname: 144
n 144(None)[return cmp(self.wymedia_resource['id'], other['id'])
]:
	i: 115&131(t)
	o: 198()

nname: 115&131
n 115&131(isinstance(other, dict) and 'id' in other)[]:
	i: 0(f)
	o: 144(t), 172(f)

nname: 85
n 85(None)[return cmp(self.wymedia_resource['id'], other.wymedia_resource['id'])
]:
	i: 47(), 84()
	o: 198()

nname: 84
n 84(None)[]:
	i: 15&31(f)
	o: 85()

nname: 47
n 47(None)[return cmp(self.name + self.type, other.name + other.type)
]:
	i: 15&31(t)
	o: 85()

nname: 15&31
n 15&31(self.wymedia_resource is None or other.wymedia_resource is None)[]:
	i: 0(t)
	o: 47(t), 84(f)

nname: 0
n 0(isinstance(other, MediaItem))[]:
	i: 
	o: 15&31(t), 115&131(f)

nname: 198
n 198(None)[return None
]:
	i: 15&31(), 115&131()
	o: 

nname: 115&131
n 115&131(None)[if isinstance(other, dict) and 'id' in other:
	return cmp(self.wymedia_resource['id'], other['id'])
else:
	return cmp(type(self), type(other))
]:
	i: 0(f)
	o: 198()

nname: 15&31
n 15&31(None)[if self.wymedia_resource is None or other.wymedia_resource is None:
	return cmp(self.name + self.type, other.name + other.type)
return cmp(self.wymedia_resource['id'], other.wymedia_resource['id'])
]:
	i: 0(t)
	o: 198()

nname: 0
n 0(isinstance(other, MediaItem))[]:
	i: 
	o: 15&31(t), 115&131(f)

nname: 0
n 0(None)[if isinstance(other, MediaItem):
	if self.wymedia_resource is None or other.wymedia_resource is None:
		return cmp(self.name + self.type, other.name + other.type)
	return cmp(self.wymedia_resource['id'], other.wymedia_resource['id'])
else:
	if isinstance(other, dict) and 'id' in other:
		return cmp(self.wymedia_resource['id'], other['id'])
	else:
		return cmp(type(self), type(other))
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0x8aeacec>}
nname: 0
n 0(None)[pl.vfs_clear()
pl.vfs_add_item(item_to_add)
pl.play(item_to_start, **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75cbf0c>}
nname: 113
n 113(None)[]:
	i: 89(), 112()
	o: 

nname: 112
n 112(None)[]:
	i: 70(f)
	o: 113()

nname: 89
n 89(None)[player.random_mode = False
player.go_random()
]:
	i: 70(t)
	o: 113()

nname: 70
n 70(player.random_mode)[player.song_changed()
]:
	i: 15(), 47()
	o: 89(t), 112(f)

nname: 47
n 47(None)[player.get_item_list('main_list').append(self)
]:
	i: 0(f)
	o: 70()

nname: 15
n 15(None)[player.get_item_list('main_list').extend(self.browse())
]:
	i: 0(t)
	o: 70()

nname: 0
n 0(isinstance(self, GenericContainer))[]:
	i: 
	o: 15(t), 47(f)

nname: 113
n 113(None)[]:
	i: 0()
	o: 

nname: 0
n 0(None)[if isinstance(self, GenericContainer):
	player.get_item_list('main_list').extend(self.browse())
else:
	player.get_item_list('main_list').append(self)
player.song_changed()
if player.random_mode:
	player.random_mode = False
	player.go_random()
]:
	i: 
	o: 113()

nname: 0
n 0(None)[if isinstance(self, GenericContainer):
	player.get_item_list('main_list').extend(self.browse())
else:
	player.get_item_list('main_list').append(self)
player.song_changed()
if player.random_mode:
	player.random_mode = False
	player.go_random()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75cb56c>}
nname: 612
n 612(None)[return None
]:
	i: 329(), 468(), 604()
	o: 

nname: 604
n 604(None)[_replace()
]:
	i: 397(f)
	o: 612()

nname: 468
n 468(None)[from pygui.window import ConfirmWindow, Button
cw = ConfirmWindow(_('Add to now playing or play this item ?'), buttons=[Button(_('Add'), True), Button(_('Replace'), False)])
cw.buttons[0].connect(_add)
cw.buttons[1].connect(_replace)
cw.show()
]:
	i: 397(t)
	o: 612()

nname: 397
n 397(self.universe == 'audio')[log.debug('NPL: player found ask for add/replace')
def _replace():
	pl.vfs_clear()
	pl.vfs_add_item(item_to_add)
	pl.play(item_to_start, **kw)

def _add():
	if isinstance(self, GenericContainer):
		player.get_item_list('main_list').extend(self.browse())
	else:
		player.get_item_list('main_list').append(self)
	player.song_changed()
	if player.random_mode:
		player.random_mode = False
		player.go_random()

]:
	i: 295(f)
	o: 468(t), 604(f)

nname: 329
n 329(None)[log.debug('NPL: no running player')
pl.vfs_clear()
pl.menu = self.menu
pl.vfs_add_item(item_to_add)
pl.play(item_to_start, **kw)
]:
	i: 295(t)
	o: 612()

nname: 295
n 295(player is None)[log.debug('NPL: pl=%s to_add=%s to_start=%s', pl, item_to_add, item_to_start)
]:
	i: 263(), 279()
	o: 329(t), 397(f)

nname: 279
n 279(None)[item_to_add = self.parent
item_to_start = self
]:
	i: 235(f)
	o: 295()

nname: 263
n 263(None)[item_to_add = self
item_to_start = None
]:
	i: 235(t)
	o: 295()

nname: 235
n 235(isinstance(self, GenericContainer))[pl = MediaItem.npl_dict[name]
]:
	i: 184(), 234()
	o: 263(t), 279(f)

nname: 234
n 234(None)[]:
	i: 156(f)
	o: 235()

nname: 184
n 184(None)[wmedia_pls = playlist_create(get_root(), name)
MediaItem.npl_dict[name] = get_mmi_object(wmedia_pls, self.menu, None)
]:
	i: 156(t)
	o: 235()

nname: 156
n 156(name not in MediaItem.npl_dict)[name = self.universe + ':npl'
]:
	i: 148(), 155()
	o: 184(t), 234(f)

nname: 155
n 155(None)[]:
	i: 36(f)
	o: 156()

nname: 148
n 148(None)[return None
]:
	i: 93(), 126(), 133(), 147(AE)
	o: 156()

nname: 133
n 133(None)[PRINT_EXCEPTION()
]:
	i: 116(f)
	o: 148()

nname: 126
n 126(None)[]:
	i: 116(t)
	o: 148()

nname: 116
n 116(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 89(except)
	o: 126(t), 133(f)

nname: 93
n 93(None)[self.player.play(self, **kw)
]:
	i: 89(try)
	o: 148()

nname: 89
n 89(None)[]:
	i: 36(t)
	o: 93(try), 116(except)

nname: 36
n 36(self.universe == 'multiverse')[ms = pygui_globs['menustack']
ms.back_to_menu(self.menu)
player = ms.get_player()
]:
	i: 12(), 35()
	o: 89(t), 155(f)

nname: 35
n 35(None)[]:
	i: 0(f)
	o: 36()

nname: 12
n 12(None)[return self.player.play(self, **kw)
]:
	i: 0(t)
	o: 36()

nname: 0
n 0('playone' in plugins)[]:
	i: 
	o: 12(t), 35(f)

nname: 295
n 295(None)[log.debug('NPL: pl=%s to_add=%s to_start=%s', pl, item_to_add, item_to_start)
if player is None:
	log.debug('NPL: no running player')
	pl.vfs_clear()
	pl.menu = self.menu
	pl.vfs_add_item(item_to_add)
	pl.play(item_to_start, **kw)
else:
	log.debug('NPL: player found ask for add/replace')
	def _replace():
		pl.vfs_clear()
		pl.vfs_add_item(item_to_add)
		pl.play(item_to_start, **kw)

	def _add():
		if isinstance(self, GenericContainer):
			player.get_item_list('main_list').extend(self.browse())
		else:
			player.get_item_list('main_list').append(self)
		player.song_changed()
		if player.random_mode:
			player.random_mode = False
			player.go_random()

	if self.universe == 'audio':
		from pygui.window import ConfirmWindow, Button
		cw = ConfirmWindow(_('Add to now playing or play this item ?'), buttons=[Button(_('Add'), True), Button(_('Replace'), False)])
		cw.buttons[0].connect(_add)
		cw.buttons[1].connect(_replace)
		cw.show()
	else:
		_replace()
return None
]:
	i: 156()
	o: 

nname: 156
n 156(None)[name = self.universe + ':npl'
if name not in MediaItem.npl_dict:
	wmedia_pls = playlist_create(get_root(), name)
	MediaItem.npl_dict[name] = get_mmi_object(wmedia_pls, self.menu, None)
pl = MediaItem.npl_dict[name]
if isinstance(self, GenericContainer):
	item_to_add = self
	item_to_start = None
else:
	item_to_add = self.parent
	item_to_start = self
]:
	i: 116(), 0(f)
	o: 295()

nname: 116
n 116(None)[except AttributeError:
	pass
except:
	PRINT_EXCEPTION()
return None
]:
	i: 89()
	o: 156()

nname: 89
n 89(None)[try:
	self.player.play(self, **kw)
]:
	i: 0(t)
	o: 116()

nname: 0
n 0(self.universe == 'multiverse')[if 'playone' in plugins:
	return self.player.play(self, **kw)
ms = pygui_globs['menustack']
ms.back_to_menu(self.menu)
player = ms.get_player()
]:
	i: 
	o: 89(t), 156(f)

nname: 156
n 156(None)[name = self.universe + ':npl'
if name not in MediaItem.npl_dict:
	wmedia_pls = playlist_create(get_root(), name)
	MediaItem.npl_dict[name] = get_mmi_object(wmedia_pls, self.menu, None)
pl = MediaItem.npl_dict[name]
if isinstance(self, GenericContainer):
	item_to_add = self
	item_to_start = None
else:
	item_to_add = self.parent
	item_to_start = self
log.debug('NPL: pl=%s to_add=%s to_start=%s', pl, item_to_add, item_to_start)
if player is None:
	log.debug('NPL: no running player')
	pl.vfs_clear()
	pl.menu = self.menu
	pl.vfs_add_item(item_to_add)
	pl.play(item_to_start, **kw)
else:
	log.debug('NPL: player found ask for add/replace')
	def _replace():
		pl.vfs_clear()
		pl.vfs_add_item(item_to_add)
		pl.play(item_to_start, **kw)

	def _add():
		if isinstance(self, GenericContainer):
			player.get_item_list('main_list').extend(self.browse())
		else:
			player.get_item_list('main_list').append(self)
		player.song_changed()
		if player.random_mode:
			player.random_mode = False
			player.go_random()

	if self.universe == 'audio':
		from pygui.window import ConfirmWindow, Button
		cw = ConfirmWindow(_('Add to now playing or play this item ?'), buttons=[Button(_('Add'), True), Button(_('Replace'), False)])
		cw.buttons[0].connect(_add)
		cw.buttons[1].connect(_replace)
		cw.show()
	else:
		_replace()
return None
]:
	i: 89(), 0(f)
	o: 

nname: 89
n 89(None)[try:
	self.player.play(self, **kw)
except AttributeError:
	pass
except:
	PRINT_EXCEPTION()
return None
]:
	i: 0(t)
	o: 156()

nname: 0
n 0(self.universe == 'multiverse')[if 'playone' in plugins:
	return self.player.play(self, **kw)
ms = pygui_globs['menustack']
ms.back_to_menu(self.menu)
player = ms.get_player()
]:
	i: 
	o: 89(t), 156(f)

nname: 0
n 0(None)[if 'playone' in plugins:
	return self.player.play(self, **kw)
ms = pygui_globs['menustack']
ms.back_to_menu(self.menu)
player = ms.get_player()
if self.universe == 'multiverse':
	try:
		self.player.play(self, **kw)
	except AttributeError:
		pass
	except:
		PRINT_EXCEPTION()
	return None
name = self.universe + ':npl'
if name not in MediaItem.npl_dict:
	wmedia_pls = playlist_create(get_root(), name)
	MediaItem.npl_dict[name] = get_mmi_object(wmedia_pls, self.menu, None)
pl = MediaItem.npl_dict[name]
if isinstance(self, GenericContainer):
	item_to_add = self
	item_to_start = None
else:
	item_to_add = self.parent
	item_to_start = self
log.debug('NPL: pl=%s to_add=%s to_start=%s', pl, item_to_add, item_to_start)
if player is None:
	log.debug('NPL: no running player')
	pl.vfs_clear()
	pl.menu = self.menu
	pl.vfs_add_item(item_to_add)
	pl.play(item_to_start, **kw)
else:
	log.debug('NPL: player found ask for add/replace')
	def _replace():
		pl.vfs_clear()
		pl.vfs_add_item(item_to_add)
		pl.play(item_to_start, **kw)

	def _add():
		if isinstance(self, GenericContainer):
			player.get_item_list('main_list').extend(self.browse())
		else:
			player.get_item_list('main_list').append(self)
		player.song_changed()
		if player.random_mode:
			player.random_mode = False
			player.go_random()

	if self.universe == 'audio':
		from pygui.window import ConfirmWindow, Button
		cw = ConfirmWindow(_('Add to now playing or play this item ?'), buttons=[Button(_('Add'), True), Button(_('Replace'), False)])
		cw.buttons[0].connect(_add)
		cw.buttons[1].connect(_replace)
		cw.show()
	else:
		_replace()
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b9b4c>}
nname: 6
n 6(None)[__doc__ = '\n    This is the base item for every media, could be considered virtual\n    All of those items are build from wymedia\n    '
npl_dict = dict()
media_update_fields = ()
def __init__(self, wymedia_resource=None, type_=None, menu=None, display_type=None, parent=None, **meta_infos):
	valid_wymedia_obj = False
	self._observers = set()
	self._metadata_handle = None
	if wymedia_resource is None:
		wymedia_resource = 'Unnamed'
	if isinstance(wymedia_resource, basestring):
		name = wymedia_resource
	else:
		if 'i18n' in wymedia_resource:
			name = _(wymedia_resource['title'])
		else:
			if wymedia_resource['title']:
				name = wymedia_resource['title'].decode('utf-8', 'ignore')
			else:
				name = _('Untitled')
		valid_wymedia_obj = True
	if not type_:
		pass
	Item.__init__(self, name=name, type_=type_, menu=menu, display_type=display_type, parent=parent)
	if valid_wymedia_obj:
		self.wymedia_resource = wymedia_resource
		self.infos = None
	else:
		self.wymedia_resource = None
		self.infos = dict(uri='unknown://void', duration=0)
		if meta_infos:
			self.infos.update(meta_infos)
	self._update_received_task = Task(self._update_received)
	self._async_media_update_task = Task(self._async_media_update)
	self._async_media_update_task.delay = 0
	self._async_media_update_task._considered_idle = True
	self.async_media_update = self._async_media_update_task.start
	return None

def __repr__(self):
	if self.wymedia_resource:
		return '<%s::%s(%s):%s>' % (self.__class__.__name__, self.type, repr(self.name), self.wymedia_resource.get('id', 'unknown'))
	else:
		return Item.__repr__(self)

def _get_parent(self):
	if not self._parent:
		if self.wymedia_resource and self['parentid']:
			if int(self['parentid']) == 0:
				self._parent = RootItem()
			else:
				wm_parent = get_object(self['parentid'], ('uri', 'class', 'title'))
				self._parent = get_mmi_object(wm_parent, self.menu, None)
	return self._parent

def _set_parent(self, item):
	self._parent = item

parent = property(_get_parent, _set_parent)
del _get_parent
del _set_parent
wpl_options = property()
def is_marked(self):
	try:
		return bool(self.wymedia_resource.get('marked'))
	except AttributeError:
		return False

def vfs_set_metas(self, _unref_link=False, **kw):
	log.debug('Setting %s to %s', kw, self)
	if not self.wymedia_resource:
		pass
	if _unref_link:
		self.wymedia_resource.update(kw)
		kw['id'] = self.wymedia_resource['refid']
		try:
			set_metadata(kw)
		except:
			log.error('set_metadata %s on %s failed!', kw, self)
			PRINT_EXCEPTION()
	else:
		for key, value in kw.iteritems():
			try:
				self[key] = value
				continue
			except:
				log.debug('setting %s[%s]=%s Failed', self, key, value)
				PRINT_EXCEPTION()
				continue

def vfs_rename(self, new_name):
	self['title'] = new_name.encode('utf-8')
	self.name = new_name

def vfs_delete(self):
	object_remove(self.wymedia_resource, {'universe': self.universe})

def handle_update(self, *args):
	self._update_received_task.args = args
	self._update_received_task.start(0, consider_idle=True)

def watch(self, observer):
	log.info('%s by %s', self, observer)
	if self.wymedia_resource is not None:
		self._observers.add(observer)
		self.async_media_update()
	return None

def unwatch(self, observer=None):
	log.info('%s by %s', self, observer)
	if self.wymedia_resource is not None:
		if observer is None:
			self._observers = set()
		else:
			self._observers.discard(observer)
		if not self._observers:
			log.info('unregister %s', self)
			unregister_update_callback(self.wymedia_resource)
	return None

watched = property((lambda self: bool(self._observers)))
def _async_media_update(self):
	if self.wymedia_resource is not None and not self._metadata_handle:
		log.info(self)
		register_update_callback(self.wymedia_resource, self.handle_update)
		get_metadata(self.wymedia_resource)
		self._metadata_handle = True
	return None

def _update_received(self, infos, kind):
	log.info(self)
	log.debug('%s infos=%s', self, infos)
	try:
		if 'title' in infos:
			if 'i18n' in infos:
				self.name = _(infos['title'])
			else:
				self.name = infos['title'].decode('utf-8')
		self.wymedia_resource.update(infos)

def media_update(self, *names):
	if self.wymedia_resource is not None:
		wm_resource = None
		if not(names or self.media_update_fields):
			pass
		wanted_attr = names
		if wanted_attr:
			log.debug('%s %s', self, wanted_attr)
			wm_resource = get_object(self['id'], wanted_attr)
			if wm_resource:
				if 'title' in wm_resource:
					if 'i18n' in wm_resource:
						self.name = _(wm_resource['title'])
					else:
						self.name = wm_resource['title'].decode('utf-8')
				index = self.wymedia_resource.get('index', None)
				if index is not None:
					wm_resource['index'] = index
				self.wymedia_resource.update(wm_resource)
	return None

def __getitem__(self, name):
	try:
		pass
	if self.wymedia_resource is not None:
		if name == 'subtitles':
			return list(WMedia2MMIObjects(get_subtitles(self.wymedia_resource), self.menu, self))
		else:
			if name == 'thumbnail':
				tn = self.wymedia_resource.get('preview')
				if tn is None:
					if hasattr(self.menu, '_thumbnail_updated'):
						self.watch(self.menu._thumbnail_updated)
					else:
						self.async_media_update()
				return tn
		data = self.wymedia_resource[name]
		if name in UNICODE_METADATA_FIELDS:
			return data.decode('utf-8')
		else:
			return data
	else:
		res = self.infos.get(name)
		if callable(res):
			res, self.infos[name] = res(), res()
		return res

def __setitem__(self, name, value):
	if self.wymedia_resource is not None:
		if name not in ('subtitles', 'thumbnail', 'preview'):
			self.wymedia_resource[name] = value
			log.debug('wymedia.set_metadata(id: %s  %s: %s)', self.wymedia_resource['id'], name, value)
			set_metadata({'id': self.wymedia_resource['id'], name: value})
	else:
		self.infos[name] = value
	return None

def execute(self, *args, **args):
	try:
		self.player.play(self, *args, **kw)
	except Exception, e:
		PRINT_EXCEPTION(e)

def __hash__(self):
	if self.wymedia_resource is None:
		return hash(self.name + self.type + self['uri'])
	return hash(self.wymedia_resource['id'])

def __eq__(self, other):
	if hasattr(other, 'wymedia_resource'):
		if self.wymedia_resource is None or other.wymedia_resource is None:
			return self.name + self.type == other.name + other.type
		return self.wymedia_resource['id'] == other.wymedia_resource['id']
	else:
		if isinstance(other, dict) and 'id' in other:
			return self.wymedia_resource['id'] == other['id']
	return None

def __ne__(self, other):
	return not self == other

def __cmp__(self, other):
	if isinstance(other, MediaItem):
		if self.wymedia_resource is None or other.wymedia_resource is None:
			return cmp(self.name + self.type, other.name + other.type)
		return cmp(self.wymedia_resource['id'], other.wymedia_resource['id'])
	else:
		if isinstance(other, dict) and 'id' in other:
			return cmp(self.wymedia_resource['id'], other['id'])
		else:
			return cmp(type(self), type(other))
	return None

def _npl_decision(self, *args, **args):
	if 'playone' in plugins:
		return self.player.play(self, **kw)
	ms = pygui_globs['menustack']
	ms.back_to_menu(self.menu)
	player = ms.get_player()
	if self.universe == 'multiverse':
		try:
			self.player.play(self, **kw)
		except AttributeError:
			pass
		except:
			PRINT_EXCEPTION()
		return None
	name = self.universe + ':npl'
	if name not in MediaItem.npl_dict:
		wmedia_pls = playlist_create(get_root(), name)
		MediaItem.npl_dict[name] = get_mmi_object(wmedia_pls, self.menu, None)
	pl = MediaItem.npl_dict[name]
	if isinstance(self, GenericContainer):
		item_to_add = self
		item_to_start = None
	else:
		item_to_add = self.parent
		item_to_start = self
	log.debug('NPL: pl=%s to_add=%s to_start=%s', pl, item_to_add, item_to_start)
	if player is None:
		log.debug('NPL: no running player')
		pl.vfs_clear()
		pl.menu = self.menu
		pl.vfs_add_item(item_to_add)
		pl.play(item_to_start, **kw)
	else:
		log.debug('NPL: player found ask for add/replace')
		def _replace():
			pl.vfs_clear()
			pl.vfs_add_item(item_to_add)
			pl.play(item_to_start, **kw)

		def _add():
			if isinstance(self, GenericContainer):
				player.get_item_list('main_list').extend(self.browse())
			else:
				player.get_item_list('main_list').append(self)
			player.song_changed()
			if player.random_mode:
				player.random_mode = False
				player.go_random()

		if self.universe == 'audio':
			from pygui.window import ConfirmWindow, Button
			cw = ConfirmWindow(_('Add to now playing or play this item ?'), buttons=[Button(_('Add'), True), Button(_('Replace'), False)])
			cw.buttons[0].connect(_add)
			cw.buttons[1].connect(_replace)
			cw.show()
		else:
			_replace()
	return None

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75c8a4c>}
nname: 0
n 0(None)[MediaItem.__init__(self, wymedia_resource, type_=type_, **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b97cc>}
nname: 0
n 0(None)[create_container(self.wymedia_resource, name)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b976c>}
nname: 0
n 0(None)[return WindowedItemList(self, menu=self.menu, universe=self.universe, sort_order=sort_order)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b960c>}
nname: 0
n 0(None)[self._npl_decision()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b960c>}
nname: 94
n 94(None)[log.warn('Unable to find a unique name')
]:
	i: 21(AL), 93()
	o: 

nname: 93
n 93(None)[]:
	i: 34(AF), 89()
	o: 94()

nname: 89
n 89(None)[]:
	i: 50(f), 81()
	o: 93()

nname: 81
n 81(None)[return real_prefix
continue
]:
	i: 50(t)
	o: 89()

nname: 50
n 50(real_prefix not in self)[for n in xrange(1, 1000):
real_prefix = prefix + str(n)
]:
	i: 34(for)
	o: 81(t), 89(f)

nname: 34
n 34(None)[]:
	i: 21(loop)
	o: 50(for), 93(AF)

nname: 21
n 21(None)[prefix += '-'
]:
	i: 12(), 20()
	o: 34(loop), 94(AL)

nname: 20
n 20(None)[]:
	i: 0(f)
	o: 21()

nname: 12
n 12(None)[return prefix
]:
	i: 0(t)
	o: 21()

nname: 0
n 0(prefix not in self)[]:
	i: 
	o: 12(t), 20(f)

nname: 94
n 94(None)[log.warn('Unable to find a unique name')
]:
	i: 0(AL), 34(AF), 50()
	o: 

nname: 50
n 50(None)[for n in xrange(1, 1000):
real_prefix = prefix + str(n)
if real_prefix not in self:
	return real_prefix
	continue
]:
	i: 34(for)
	o: 94()

nname: 34
n 34(None)[]:
	i: 0(loop)
	o: 50(for), 94(AF)

nname: 0
n 0(None)[if prefix not in self:
	return prefix
prefix += '-'
]:
	i: 
	o: 34(loop), 94(AL)

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b98ec>, 34: <unpyclib.structure.node instance at 0xb75b9bac>, 50: <unpyclib.structure.node instance at 0xb75b9aac>, 94: <unpyclib.structure.node instance at 0xb75b996c>}
nname: 117
n 117(None)[]:
	i: 90(), 100()
	o: 

nname: 100
n 100(None)[raise KeyError("No such child: '%s'" % name)
]:
	i: 0(f)
	o: 117()

nname: 90
n 90(None)[return get_mmi_object(result_set[0], menu, self)
]:
	i: 67(t), 83()
	o: 117()

nname: 83
n 83(None)[]:
	i: 67(f)
	o: 90()

nname: 67
n 67(menu)[]:
	i: 46(), 66()
	o: 83(f), 90(t)

nname: 66
n 66(None)[]:
	i: 27(f)
	o: 67()

nname: 46
n 46(None)[log.warn("Query for '%s' returned more than 1 child.", name)
]:
	i: 27(t)
	o: 67()

nname: 27
n 27(len(result_set) > 1)[]:
	i: 0(t)
	o: 46(t), 66(f)

nname: 0
n 0(result_set)[result_set = container_search(self.wymedia_resource, 'title', name)
]:
	i: 
	o: 27(t), 100(f)

nname: 117
n 117(None)[]:
	i: 90(), 100()
	o: 

nname: 100
n 100(None)[raise KeyError("No such child: '%s'" % name)
]:
	i: 0(f)
	o: 117()

nname: 90
n 90(None)[return get_mmi_object(result_set[0], menu, self)
]:
	i: 27(t)
	o: 117()

nname: 27
n 27(None)[if len(result_set) > 1:
	log.warn("Query for '%s' returned more than 1 child.", name)
if not menu:
	pass
]:
	i: 0(t)
	o: 90()

nname: 0
n 0(result_set)[result_set = container_search(self.wymedia_resource, 'title', name)
]:
	i: 
	o: 27(t), 100(f)

nname: 117
n 117(None)[]:
	i: 27(), 100()
	o: 

nname: 100
n 100(None)[raise KeyError("No such child: '%s'" % name)
]:
	i: 0(f)
	o: 117()

nname: 27
n 27(None)[if len(result_set) > 1:
	log.warn("Query for '%s' returned more than 1 child.", name)
if not menu:
	pass
return get_mmi_object(result_set[0], menu, self)
]:
	i: 0(t)
	o: 117()

nname: 0
n 0(result_set)[result_set = container_search(self.wymedia_resource, 'title', name)
]:
	i: 
	o: 27(t), 100(f)

nname: 0
n 0(None)[result_set = container_search(self.wymedia_resource, 'title', name)
if result_set:
	if len(result_set) > 1:
		log.warn("Query for '%s' returned more than 1 child.", name)
	if not menu:
		pass
	return get_mmi_object(result_set[0], menu, self)
else:
	raise KeyError("No such child: '%s'" % name)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b9b4c>}
nname: 58
n 58(None)[]:
	i: 3(), 35(), 57(AE)
	o: 

nname: 35
n 35(None)[log.warn('%s does not support get_child_count()', self)
]:
	i: 0(except)
	o: 58()

nname: 3
n 3(None)[return get_child_count(self.wymedia_resource, dict(universe=self.universe))
]:
	i: 0(try)
	o: 58()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 35(except)

nname: 35
n 35(None)[except:
	log.warn('%s does not support get_child_count()', self)
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	return get_child_count(self.wymedia_resource, dict(universe=self.universe))
]:
	i: 
	o: 35()

nname: 0
n 0(None)[try:
	return get_child_count(self.wymedia_resource, dict(universe=self.universe))
except:
	log.warn('%s does not support get_child_count()', self)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b968c>}
nname: 0
n 0(None)[return bool(container_search(self.wymedia_resource, 'title', name))
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b95cc>}
nname: 6
n 6(None)[__doc__ = ' Item representing directory '
def __init__(self, wymedia_resource, type_='dir', **kw):
	MediaItem.__init__(self, wymedia_resource, type_=type_, **kw)

def vfs_mkdir(self, name):
	create_container(self.wymedia_resource, name)

def browse(self, sort_order=None):
	return WindowedItemList(self, menu=self.menu, universe=self.universe, sort_order=sort_order)

def execute(self):
	self._npl_decision()

def get_free_child_name(self, prefix):
	if prefix not in self:
		return prefix
	prefix += '-'

def get_child(self, name, menu=None):
	result_set = container_search(self.wymedia_resource, 'title', name)
	if result_set:
		if len(result_set) > 1:
			log.warn("Query for '%s' returned more than 1 child.", name)
		if not menu:
			pass
		return get_mmi_object(result_set[0], menu, self)
	else:
		raise KeyError("No such child: '%s'" % name)

def get_child_count(self):
	try:
		return get_child_count(self.wymedia_resource, dict(universe=self.universe))
	except:
		log.warn('%s does not support get_child_count()', self)

def __contains__(self, name):
	return bool(container_search(self.wymedia_resource, 'title', name))

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75b946c>}
nname: 0
n 0(None)[MediaItem.__init__(self, wymedia_resource, type_=type_, **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b976c>}
nname: 149
n 149(None)[return None
]:
	i: 43(AL), 106(), 123()
	o: 

nname: 123
n 123(None)[starts_with.player.play(starts_with, playlist=items, **kw)
]:
	i: 0(f)
	o: 149()

nname: 106
n 106(None)[log.info('Nothing to play here')
]:
	i: 47(AF), 102()
	o: 149()

nname: 102
n 102(None)[]:
	i: 54(f), 72()
	o: 106()

nname: 72
n 72(None)[it.player.play(it, playlist=items, **kw)
break
continue
]:
	i: 54(t)
	o: 102()

nname: 54
n 54(hasattr(it, 'player'))[for it in items:
]:
	i: 47(for)
	o: 72(t), 102(f)

nname: 47
n 47(None)[]:
	i: 43(loop)
	o: 54(for), 106(AF)

nname: 43
n 43(None)[]:
	i: 0(t)
	o: 47(loop), 149(AL)

nname: 0
n 0(starts_with is None)[log.debug('%s.play(starts_with=%s)', self, starts_with)
items = self.browse()
]:
	i: 
	o: 43(t), 123(f)

nname: 149
n 149(None)[return None
]:
	i: 43(AL), 106(), 123()
	o: 

nname: 123
n 123(None)[starts_with.player.play(starts_with, playlist=items, **kw)
]:
	i: 0(f)
	o: 149()

nname: 106
n 106(None)[log.info('Nothing to play here')
]:
	i: 47(AF), 54()
	o: 149()

nname: 54
n 54(None)[for it in items:
if hasattr(it, 'player'):
	it.player.play(it, playlist=items, **kw)
	break
	continue
]:
	i: 47(for)
	o: 106()

nname: 47
n 47(None)[]:
	i: 43(loop)
	o: 54(for), 106(AF)

nname: 43
n 43(None)[]:
	i: 0(t)
	o: 47(loop), 149(AL)

nname: 0
n 0(starts_with is None)[log.debug('%s.play(starts_with=%s)', self, starts_with)
items = self.browse()
]:
	i: 
	o: 43(t), 123(f)

nname: 149
n 149(None)[return None
]:
	i: 54(), 123()
	o: 

nname: 123
n 123(None)[starts_with.player.play(starts_with, playlist=items, **kw)
]:
	i: 0(f)
	o: 149()

nname: 54
n 54(None)[for it in items:
	if hasattr(it, 'player'):
		it.player.play(it, playlist=items, **kw)
		break
		continue
else:
	log.info('Nothing to play here')
]:
	i: 43(for)
	o: 149()

nname: 43
n 43(None)[]:
	i: 0(t)
	o: 54(for)

nname: 0
n 0(starts_with is None)[log.debug('%s.play(starts_with=%s)', self, starts_with)
items = self.browse()
]:
	i: 
	o: 43(t), 123(f)

nname: 149
n 149(None)[return None
]:
	i: 43(), 123()
	o: 

nname: 123
n 123(None)[starts_with.player.play(starts_with, playlist=items, **kw)
]:
	i: 0(f)
	o: 149()

nname: 43
n 43(None)[for it in items:
	if hasattr(it, 'player'):
		it.player.play(it, playlist=items, **kw)
		break
		continue
else:
	log.info('Nothing to play here')
]:
	i: 0(t)
	o: 149()

nname: 0
n 0(starts_with is None)[log.debug('%s.play(starts_with=%s)', self, starts_with)
items = self.browse()
]:
	i: 
	o: 43(t), 123(f)

nname: 0
n 0(None)[log.debug('%s.play(starts_with=%s)', self, starts_with)
items = self.browse()
if starts_with is None:
	for it in items:
		if hasattr(it, 'player'):
			it.player.play(it, playlist=items, **kw)
			break
			continue
	else:
		log.info('Nothing to play here')
else:
	starts_with.player.play(starts_with, playlist=items, **kw)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b99cc>}
nname: 53
n 53(None)[DirItem.execute(self)
]:
	i: 31(), 52()
	o: 

nname: 52
n 52(None)[]:
	i: 0(f)
	o: 53()

nname: 31
n 31(None)[log.debug("Can't play Now Playing List !")
]:
	i: 0(t)
	o: 53()

nname: 0
n 0(self == Markerlist.now_playing)[from pygui.markerlist import Markerlist
]:
	i: 
	o: 31(t), 52(f)

nname: 0
n 0(None)[from pygui.markerlist import Markerlist
if self == Markerlist.now_playing:
	log.debug("Can't play Now Playing List !")
DirItem.execute(self)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b95ec>}
nname: 129
n 129(None)[from pygui.menu.menu import PlaylistEditor
PlaylistEditor(playlist=self, universe=self.menu.universe).show(hide_previous_menu=False)
]:
	i: 107(), 128()
	o: 

nname: 128
n 128(None)[]:
	i: 91(f)
	o: 129()

nname: 107
n 107(None)[log.error("Can't edit remote playlist!")
]:
	i: 91(t)
	o: 129()

nname: 91
n 91(self['backend'] == 'upnp')[]:
	i: 69(), 90()
	o: 107(t), 128(f)

nname: 90
n 90(None)[]:
	i: 53(f)
	o: 91()

nname: 69
n 69(None)[log.error("Can't edit M3U playlist!")
]:
	i: 53(t)
	o: 91()

nname: 53
n 53(self['mimeType'] == 'audio/mpegurl')[]:
	i: 31(), 52()
	o: 69(t), 90(f)

nname: 52
n 52(None)[]:
	i: 0(f)
	o: 53()

nname: 31
n 31(None)[log.error("Can't edit Now Playing List!")
]:
	i: 0(t)
	o: 53()

nname: 0
n 0(self == Markerlist.now_playing)[from pygui.markerlist import Markerlist
]:
	i: 
	o: 31(t), 52(f)

nname: 91
n 91(None)[if self['backend'] == 'upnp':
	log.error("Can't edit remote playlist!")
from pygui.menu.menu import PlaylistEditor
PlaylistEditor(playlist=self, universe=self.menu.universe).show(hide_previous_menu=False)
]:
	i: 0()
	o: 

nname: 0
n 0(None)[from pygui.markerlist import Markerlist
if self == Markerlist.now_playing:
	log.error("Can't edit Now Playing List!")
if self['mimeType'] == 'audio/mpegurl':
	log.error("Can't edit M3U playlist!")
]:
	i: 
	o: 91()

nname: 0
n 0(None)[from pygui.markerlist import Markerlist
if self == Markerlist.now_playing:
	log.error("Can't edit Now Playing List!")
if self['mimeType'] == 'audio/mpegurl':
	log.error("Can't edit M3U playlist!")
if self['backend'] == 'upnp':
	log.error("Can't edit remote playlist!")
from pygui.menu.menu import PlaylistEditor
PlaylistEditor(playlist=self, universe=self.menu.universe).show(hide_previous_menu=False)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b974c>}
nname: 292
n 292(None)[]:
	i: 252(), 275()
	o: 

nname: 275
n 275(None)[return playlist_append_child(self.wymedia_resource, item)
]:
	i: 237(t)
	o: 292()

nname: 252
n 252(None)[return playlist_append_marker_list(self.wymedia_resource, item.wymedia_resource)
]:
	i: 237(f)
	o: 292()

nname: 237
n 237(isinstance(item, dict))[]:
	i: 213(), 236()
	o: 252(f), 275(t)

nname: 236
n 236(None)[]:
	i: 198(f)
	o: 237()

nname: 213
n 213(None)[return playlist_append_child(self.wymedia_resource, item.wymedia_resource)
]:
	i: 198(t)
	o: 237()

nname: 198
n 198(isinstance(item, Item))[]:
	i: 169(), 197()
	o: 213(t), 236(f)

nname: 197
n 197(None)[]:
	i: 0(f)
	o: 198()

nname: 169
n 169(None)[return playlist_append_container(self.wymedia_resource, item.wymedia_resource, wymedia_sorting, browse_options)
]:
	i: 98(JA), 146(), 168()
	o: 198()

nname: 168
n 168(None)[]:
	i: 15(f)
	o: 169()

nname: 146
n 146(None)[maturity_rating = 19
browse_options['maturity_rating'] = str(maturity_rating)
]:
	i: 135(), 142()
	o: 169()

nname: 142
n 142(None)[]:
	i: 120(f)
	o: 146()

nname: 135
n 135(None)[]:
	i: 120(t)
	o: 146()

nname: 120
n 120(user_config['security']['show_hidden'])[]:
	i: 64(t)
	o: 135(t), 142(f)

nname: 98
n 98(None)[maturity_rating = user_config['security']['maturity_rating']
browse_options['maturity_rating'] = str(maturity_rating)
]:
	i: 79(t), 94()
	o: 169(JA)

nname: 94
n 94(None)[]:
	i: 79(f)
	o: 98()

nname: 79
n 79(user_config['security']['maturity_rating'])[]:
	i: 64(f)
	o: 94(f), 98(t)

nname: 64
n 64(user_config['security']['parent_mode'])[]:
	i: 15(t)
	o: 79(f), 120(t)

nname: 15
n 15(user_config['security']['parental_control'])[from pygui.config import admin_age
browse_options = dict(universe=self.universe)
]:
	i: 0(t)
	o: 64(t), 168(f)

nname: 0
n 0(isinstance(item, DirItem))[]:
	i: 
	o: 15(t), 197(f)

nname: 292
n 292(None)[]:
	i: 198()
	o: 

nname: 198
n 198(None)[if isinstance(item, Item):
	return playlist_append_child(self.wymedia_resource, item.wymedia_resource)
if not isinstance(item, dict):
	return playlist_append_marker_list(self.wymedia_resource, item.wymedia_resource)
else:
	return playlist_append_child(self.wymedia_resource, item)
]:
	i: 169(), 0(f)
	o: 292()

nname: 169
n 169(None)[return playlist_append_container(self.wymedia_resource, item.wymedia_resource, wymedia_sorting, browse_options)
]:
	i: 79(JA), 120(), 15(f)
	o: 198()

nname: 120
n 120(None)[if user_config['security']['show_hidden']:
	pass
maturity_rating = 19
browse_options['maturity_rating'] = str(maturity_rating)
]:
	i: 64(t)
	o: 169()

nname: 79
n 79(None)[if not user_config['security']['maturity_rating']:
	pass
maturity_rating = user_config['security']['maturity_rating']
browse_options['maturity_rating'] = str(maturity_rating)
]:
	i: 64(f)
	o: 169(JA)

nname: 64
n 64(user_config['security']['parent_mode'])[]:
	i: 15(t)
	o: 79(f), 120(t)

nname: 15
n 15(user_config['security']['parental_control'])[from pygui.config import admin_age
browse_options = dict(universe=self.universe)
]:
	i: 0(t)
	o: 64(t), 169(f)

nname: 0
n 0(isinstance(item, DirItem))[]:
	i: 
	o: 15(t), 198(f)

nname: 198
n 198(None)[if isinstance(item, Item):
	return playlist_append_child(self.wymedia_resource, item.wymedia_resource)
if not isinstance(item, dict):
	return playlist_append_marker_list(self.wymedia_resource, item.wymedia_resource)
else:
	return playlist_append_child(self.wymedia_resource, item)
]:
	i: 15(), 0(f)
	o: 

nname: 15
n 15(None)[from pygui.config import admin_age
browse_options = dict(universe=self.universe)
if user_config['security']['parental_control']:
	if not user_config['security']['parent_mode']:
		if not user_config['security']['maturity_rating']:
			pass
		maturity_rating = user_config['security']['maturity_rating']
		browse_options['maturity_rating'] = str(maturity_rating)
	else:
		if user_config['security']['show_hidden']:
			pass
		maturity_rating = 19
		browse_options['maturity_rating'] = str(maturity_rating)
return playlist_append_container(self.wymedia_resource, item.wymedia_resource, wymedia_sorting, browse_options)
]:
	i: 0(t)
	o: 198()

nname: 0
n 0(isinstance(item, DirItem))[]:
	i: 
	o: 15(t), 198(f)

nname: 0
n 0(None)[if isinstance(item, DirItem):
	from pygui.config import admin_age
	browse_options = dict(universe=self.universe)
	if user_config['security']['parental_control']:
		if not user_config['security']['parent_mode']:
			if not user_config['security']['maturity_rating']:
				pass
			maturity_rating = user_config['security']['maturity_rating']
			browse_options['maturity_rating'] = str(maturity_rating)
		else:
			if user_config['security']['show_hidden']:
				pass
			maturity_rating = 19
			browse_options['maturity_rating'] = str(maturity_rating)
	return playlist_append_container(self.wymedia_resource, item.wymedia_resource, wymedia_sorting, browse_options)
if isinstance(item, Item):
	return playlist_append_child(self.wymedia_resource, item.wymedia_resource)
if not isinstance(item, dict):
	return playlist_append_marker_list(self.wymedia_resource, item.wymedia_resource)
else:
	return playlist_append_child(self.wymedia_resource, item)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b64ec>}
nname: 0
n 0(None)[playlist_clear(self.wymedia_resource)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b976c>}
nname: 77
n 77(None)[object_remove(children[0], {'universe': self.universe})
]:
	i: 60(), 76()
	o: 

nname: 76
n 76(None)[]:
	i: 29(t)
	o: 77()

nname: 60
n 60(None)[raise ValueError('Playlist.vfs_del_item(x): x not in playlist')
]:
	i: 29(f)
	o: 77()

nname: 29
n 29(children)[children = container_search(self.wymedia_resource, 'refid', item['id'])
]:
	i: 15(), 28()
	o: 60(f), 76(t)

nname: 28
n 28(None)[]:
	i: 0(f)
	o: 29()

nname: 15
n 15(None)[item = item.wymedia_resource
]:
	i: 0(t)
	o: 29()

nname: 0
n 0(isinstance(item, Item))[]:
	i: 
	o: 15(t), 28(f)

nname: 77
n 77(None)[object_remove(children[0], {'universe': self.universe})
]:
	i: 0()
	o: 

nname: 0
n 0(None)[if isinstance(item, Item):
	item = item.wymedia_resource
children = container_search(self.wymedia_resource, 'refid', item['id'])
if not children:
	raise ValueError('Playlist.vfs_del_item(x): x not in playlist')
]:
	i: 
	o: 77()

nname: 0
n 0(None)[if isinstance(item, Item):
	item = item.wymedia_resource
children = container_search(self.wymedia_resource, 'refid', item['id'])
if not children:
	raise ValueError('Playlist.vfs_del_item(x): x not in playlist')
object_remove(children[0], {'universe': self.universe})
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b99ec>}
nname: 6
n 6(None)[__doc__ = ' Playlist object, launch an editor on browse() (see browse_action) '
def __init__(self, wymedia_resource, type_='playlist', **kw):
	MediaItem.__init__(self, wymedia_resource, type_=type_, **kw)

def play(self, starts_with=None, **kw):
	log.debug('%s.play(starts_with=%s)', self, starts_with)
	items = self.browse()
	if starts_with is None:
		for it in items:
			if hasattr(it, 'player'):
				it.player.play(it, playlist=items, **kw)
				break
				continue
		else:
			log.info('Nothing to play here')
	else:
		starts_with.player.play(starts_with, playlist=items, **kw)
	return None

def execute(self):
	from pygui.markerlist import Markerlist
	if self == Markerlist.now_playing:
		log.debug("Can't play Now Playing List !")
	DirItem.execute(self)

def browse_action(self):
	from pygui.markerlist import Markerlist
	if self == Markerlist.now_playing:
		log.error("Can't edit Now Playing List!")
	if self['mimeType'] == 'audio/mpegurl':
		log.error("Can't edit M3U playlist!")
	if self['backend'] == 'upnp':
		log.error("Can't edit remote playlist!")
	from pygui.menu.menu import PlaylistEditor
	PlaylistEditor(playlist=self, universe=self.menu.universe).show(hide_previous_menu=False)

def vfs_add_item(self, item):
	if isinstance(item, DirItem):
		from pygui.config import admin_age
		browse_options = dict(universe=self.universe)
		if user_config['security']['parental_control']:
			if not user_config['security']['parent_mode']:
				if not user_config['security']['maturity_rating']:
					pass
				maturity_rating = user_config['security']['maturity_rating']
				browse_options['maturity_rating'] = str(maturity_rating)
			else:
				if user_config['security']['show_hidden']:
					pass
				maturity_rating = 19
				browse_options['maturity_rating'] = str(maturity_rating)
		return playlist_append_container(self.wymedia_resource, item.wymedia_resource, wymedia_sorting, browse_options)
	if isinstance(item, Item):
		return playlist_append_child(self.wymedia_resource, item.wymedia_resource)
	if not isinstance(item, dict):
		return playlist_append_marker_list(self.wymedia_resource, item.wymedia_resource)
	else:
		return playlist_append_child(self.wymedia_resource, item)

def vfs_clear(self):
	playlist_clear(self.wymedia_resource)

def vfs_del_item(self, item):
	if isinstance(item, Item):
		item = item.wymedia_resource
	children = container_search(self.wymedia_resource, 'refid', item['id'])
	if not children:
		raise ValueError('Playlist.vfs_del_item(x): x not in playlist')
	object_remove(children[0], {'universe': self.universe})

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75c2fec>}
nname: 0
n 0(None)[return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b9b6c>}
nname: 0
n 0(None)[return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b946c>}
nname: 0
n 0(None)[return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b902c>}
nname: 0
n 0(None)[return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b97ac>}
nname: 75
n 75(None)[log.debug('Root::get')
egg = get_root()
self._sort = ['family'] + list(wymedia_sorting)
MediaItem.__init__(self, egg, type_='root')
pygui_globs['db_root'] = self
]:
	i: 32(), 53(), 73(AE)
	o: 

nname: 73
n 73(None)[]:
	i: 43(f)
	o: 75(AE)

nname: 53
n 53(None)[log.debug('No space left on device')
]:
	i: 43(t)
	o: 75()

nname: 43
n 43(<dummy_ex3> EXC_MATCH FreeSpaceCriticalError)[]:
	i: 0(except)
	o: 53(t), 73(f)

nname: 32
n 32(None)[init()
]:
	i: 0(try)
	o: 75()

nname: 0
n 0(None)[from wymedia.wmplus import init
log.debug('Root::init')
]:
	i: 
	o: 32(try), 43(except)

nname: 43
n 43(None)[except FreeSpaceCriticalError:
	log.debug('No space left on device')
log.debug('Root::get')
egg = get_root()
self._sort = ['family'] + list(wymedia_sorting)
MediaItem.__init__(self, egg, type_='root')
pygui_globs['db_root'] = self
]:
	i: 0()
	o: 

nname: 0
n 0(None)[from wymedia.wmplus import init
log.debug('Root::init')
try:
	init()
]:
	i: 
	o: 43()

nname: 0
n 0(None)[from wymedia.wmplus import init
log.debug('Root::init')
try:
	init()
except FreeSpaceCriticalError:
	log.debug('No space left on device')
log.debug('Root::get')
egg = get_root()
self._sort = ['family'] + list(wymedia_sorting)
MediaItem.__init__(self, egg, type_='root')
pygui_globs['db_root'] = self
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b9e6c>}
nname: 484
n 484(None)[return wm_obj
]:
	i: 475(JA), 480(), 483()
	o: 

nname: 483
n 483(None)[]:
	i: 269(f)
	o: 484()

nname: 480
n 480(None)[]:
	i: 391(AL), 479()
	o: 484()

nname: 479
n 479(None)[]:
	i: 379(f)
	o: 480()

nname: 475
n 475(None)[]:
	i: 395(AF), 472()
	o: 484(JA)

nname: 472
n 472(None)[]:
	i: 446(AE)
	o: 475()

nname: 446
n 446(None)[log.warning('Unable to load %s!', cls.__name__)
continue
]:
	i: 405(except), 411()
	o: 472(AE)

nname: 411
n 411(None)[wm_obj.append(cls(menu=self.menu, parent=self))
continue
]:
	i: 405(try)
	o: 446()

nname: 405
n 405(None)[for cls in (XkcdFolder,):
]:
	i: 395(for)
	o: 411(try), 446(except)

nname: 395
n 395(None)[]:
	i: 391(loop)
	o: 405(for), 475(AF)

nname: 391
n 391(None)[]:
	i: 379(t)
	o: 395(loop), 480(AL)

nname: 379
n 379('video' in universe)[]:
	i: 320(JA), 355(JA), 375(), 378()
	o: 391(t), 479(f)

nname: 378
n 378(None)[]:
	i: 281(f)
	o: 379()

nname: 355
n 355(None)[log.warning('Unable to load Shoutcast')
]:
	i: 316(except)
	o: 379(JA)

nname: 320
n 320(None)[wm_obj.append(ShoutCastFolder(menu=self.menu, parent=self))
]:
	i: 316(try)
	o: 379(JA)

nname: 316
n 316(None)[]:
	i: 281(t)
	o: 320(try), 355(except)

nname: 281
n 281('audio' in universe)[from .dilbert import XkcdFolder, ShoutCastFolder
]:
	i: 269(t)
	o: 316(t), 378(f)

nname: 269
n 269('dilbert' in plugins)[]:
	i: 229(JA), 264(), 268()
	o: 281(t), 483(f)

nname: 268
n 268(None)[]:
	i: 156(f)
	o: 269()

nname: 264
n 264(None)[]:
	i: 217(f)
	o: 269()

nname: 229
n 229(None)[wm_obj.append(DailyMotionContainer(parent=self, menu=self.menu))
]:
	i: 217(t)
	o: 269(JA)

nname: 217
n 217('dailymotion' in plugins)[]:
	i: 181(), 216()
	o: 229(t), 264(f)

nname: 216
n 216(None)[]:
	i: 168(f)
	o: 217()

nname: 181
n 181(None)[wm_obj.append(YouTubeContainer(parent=self, menu=self.menu))
]:
	i: 168(t)
	o: 217()

nname: 168
n 168('youtube' in plugins)[]:
	i: 156(t)
	o: 181(t), 216(f)

nname: 156
n 156('video' in universe)[]:
	i: 133(), 155()
	o: 168(t), 268(f)

nname: 155
n 155(None)[]:
	i: 41(f)
	o: 156()

nname: 133
n 133(None)[wm_obj = list(reversed(wm_obj))
]:
	i: 41(t)
	o: 156()

nname: 41
n 41('sysfuck' in plugins)[log.debug('browsing root...')
ret = browse_ng(self.wymedia_resource, 0, 100, self._sort, options)
log.debug('converting result...')
wm_obj = list(WMedia2MMIObjects(ret, menu, self))
]:
	i: 12(), 25()
	o: 133(t), 155(f)

nname: 25
n 25(None)[options = dict(universe=universe)
]:
	i: 0(f)
	o: 41()

nname: 12
n 12(None)[options = dict()
]:
	i: 0(t)
	o: 41()

nname: 0
n 0(universe == 'multiverse')[]:
	i: 
	o: 12(t), 25(f)

nname: 484
n 484(None)[return wm_obj
]:
	i: 395(AF), 446(AE), 391(AL), 379(f), 269(f)
	o: 

nname: 446
n 446(None)[except:
	log.warning('Unable to load %s!', cls.__name__)
	continue
]:
	i: 405()
	o: 484(AE)

nname: 405
n 405(None)[for cls in (XkcdFolder,):
try:
	wm_obj.append(cls(menu=self.menu, parent=self))
	continue
]:
	i: 395(for)
	o: 446()

nname: 395
n 395(None)[]:
	i: 391(loop)
	o: 405(for), 484(AF)

nname: 391
n 391(None)[]:
	i: 379(t)
	o: 395(loop), 484(AL)

nname: 379
n 379('video' in universe)[]:
	i: 355(JA), 375(), 281(f)
	o: 391(t), 484(f)

nname: 355
n 355(None)[except:
	log.warning('Unable to load Shoutcast')
]:
	i: 316()
	o: 379(JA)

nname: 316
n 316(None)[try:
	wm_obj.append(ShoutCastFolder(menu=self.menu, parent=self))
]:
	i: 281(t)
	o: 355()

nname: 281
n 281('audio' in universe)[from .dilbert import XkcdFolder, ShoutCastFolder
]:
	i: 269(t)
	o: 316(t), 379(f)

nname: 269
n 269('dilbert' in plugins)[]:
	i: 168(JA), 156(f)
	o: 281(t), 484(f)

nname: 168
n 168(None)[if 'youtube' in plugins:
	wm_obj.append(YouTubeContainer(parent=self, menu=self.menu))
if 'dailymotion' in plugins:
	wm_obj.append(DailyMotionContainer(parent=self, menu=self.menu))
]:
	i: 156(t)
	o: 269(JA)

nname: 156
n 156('video' in universe)[]:
	i: 0()
	o: 168(t), 269(f)

nname: 0
n 0(None)[if universe == 'multiverse':
	options = dict()
else:
	options = dict(universe=universe)
log.debug('browsing root...')
ret = browse_ng(self.wymedia_resource, 0, 100, self._sort, options)
log.debug('converting result...')
wm_obj = list(WMedia2MMIObjects(ret, menu, self))
if 'sysfuck' in plugins:
	wm_obj = list(reversed(wm_obj))
]:
	i: 
	o: 156()

nname: 484
n 484(None)[return wm_obj
]:
	i: 395(AF), 405(AE), 391(AL), 379(f), 269(f)
	o: 

nname: 405
n 405(None)[for cls in (XkcdFolder,):
try:
	wm_obj.append(cls(menu=self.menu, parent=self))
	continue
except:
	log.warning('Unable to load %s!', cls.__name__)
	continue
]:
	i: 395(for)
	o: 484(AE)

nname: 395
n 395(None)[]:
	i: 391(loop)
	o: 405(for), 484(AF)

nname: 391
n 391(None)[]:
	i: 379(t)
	o: 395(loop), 484(AL)

nname: 379
n 379('video' in universe)[]:
	i: 316(JA), 375(), 281(f)
	o: 391(t), 484(f)

nname: 316
n 316(None)[try:
	wm_obj.append(ShoutCastFolder(menu=self.menu, parent=self))
except:
	log.warning('Unable to load Shoutcast')
]:
	i: 281(t)
	o: 379(JA)

nname: 281
n 281('audio' in universe)[from .dilbert import XkcdFolder, ShoutCastFolder
]:
	i: 269(t)
	o: 316(t), 379(f)

nname: 269
n 269('dilbert' in plugins)[]:
	i: 0(f)
	o: 281(t), 484(f)

nname: 0
n 0(None)[if universe == 'multiverse':
	options = dict()
else:
	options = dict(universe=universe)
log.debug('browsing root...')
ret = browse_ng(self.wymedia_resource, 0, 100, self._sort, options)
log.debug('converting result...')
wm_obj = list(WMedia2MMIObjects(ret, menu, self))
if 'sysfuck' in plugins:
	wm_obj = list(reversed(wm_obj))
if 'video' in universe:
	if 'youtube' in plugins:
		wm_obj.append(YouTubeContainer(parent=self, menu=self.menu))
	if 'dailymotion' in plugins:
		wm_obj.append(DailyMotionContainer(parent=self, menu=self.menu))
]:
	i: 
	o: 269(JA)

nname: 484
n 484(None)[return wm_obj
]:
	i: 405(AE), 379(f), 0(f)
	o: 

nname: 405
n 405(None)[for cls in (XkcdFolder,):
	try:
		wm_obj.append(cls(menu=self.menu, parent=self))
		continue
	except:
		log.warning('Unable to load %s!', cls.__name__)
		continue
]:
	i: 391(for)
	o: 484(AE)

nname: 391
n 391(None)[]:
	i: 379(t)
	o: 405(for)

nname: 379
n 379('video' in universe)[]:
	i: 375(), 281(f)
	o: 391(t), 484(f)

nname: 281
n 281(None)[from .dilbert import XkcdFolder, ShoutCastFolder
if 'audio' in universe:
	try:
		wm_obj.append(ShoutCastFolder(menu=self.menu, parent=self))
	except:
		log.warning('Unable to load Shoutcast')
]:
	i: 0(t)
	o: 379(JA)

nname: 0
n 0('dilbert' in plugins)[if universe == 'multiverse':
	options = dict()
else:
	options = dict(universe=universe)
log.debug('browsing root...')
ret = browse_ng(self.wymedia_resource, 0, 100, self._sort, options)
log.debug('converting result...')
wm_obj = list(WMedia2MMIObjects(ret, menu, self))
if 'sysfuck' in plugins:
	wm_obj = list(reversed(wm_obj))
if 'video' in universe:
	if 'youtube' in plugins:
		wm_obj.append(YouTubeContainer(parent=self, menu=self.menu))
	if 'dailymotion' in plugins:
		wm_obj.append(DailyMotionContainer(parent=self, menu=self.menu))
]:
	i: 
	o: 281(t), 484(f)

nname: 484
n 484(None)[return wm_obj
]:
	i: 391(AE), 379(f), 0(f)
	o: 

nname: 391
n 391(None)[for cls in (XkcdFolder,):
	try:
		wm_obj.append(cls(menu=self.menu, parent=self))
		continue
	except:
		log.warning('Unable to load %s!', cls.__name__)
		continue
]:
	i: 379(t)
	o: 484(AE)

nname: 379
n 379('video' in universe)[]:
	i: 375(), 281(f)
	o: 391(t), 484(f)

nname: 281
n 281(None)[from .dilbert import XkcdFolder, ShoutCastFolder
if 'audio' in universe:
	try:
		wm_obj.append(ShoutCastFolder(menu=self.menu, parent=self))
	except:
		log.warning('Unable to load Shoutcast')
]:
	i: 0(t)
	o: 379(JA)

nname: 0
n 0('dilbert' in plugins)[if universe == 'multiverse':
	options = dict()
else:
	options = dict(universe=universe)
log.debug('browsing root...')
ret = browse_ng(self.wymedia_resource, 0, 100, self._sort, options)
log.debug('converting result...')
wm_obj = list(WMedia2MMIObjects(ret, menu, self))
if 'sysfuck' in plugins:
	wm_obj = list(reversed(wm_obj))
if 'video' in universe:
	if 'youtube' in plugins:
		wm_obj.append(YouTubeContainer(parent=self, menu=self.menu))
	if 'dailymotion' in plugins:
		wm_obj.append(DailyMotionContainer(parent=self, menu=self.menu))
]:
	i: 
	o: 281(t), 484(f)

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b670c>, 391: <unpyclib.structure.node instance at 0x8af772c>, 281: <unpyclib.structure.node instance at 0x8af7e8c>, 484: <unpyclib.structure.node instance at 0x8aeafcc>, 374: <unpyclib.structure.node instance at 0x8aea04c>, 375: <unpyclib.structure.node instance at 0x8aeae2c>, 379: <unpyclib.structure.node instance at 0x8aea3ec>}
nname: 0
n 0(None)[pygui_globs['menustack'].back_one_menu()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b976c>}
nname: 6
n 6(None)[__doc__ = ' The root item, mother of every item '
__metaclass__ = MetaSingleton
parent = property((lambda self: None), (lambda self, val: None))
def __init__(self):
	from wymedia.wmplus import init
	log.debug('Root::init')
	try:
		init()
	except FreeSpaceCriticalError:
		log.debug('No space left on device')
	log.debug('Root::get')
	egg = get_root()
	self._sort = ['family'] + list(wymedia_sorting)
	MediaItem.__init__(self, egg, type_='root')
	pygui_globs['db_root'] = self

def browse(self, universe='main', menu=None):
	if universe == 'multiverse':
		options = dict()
	else:
		options = dict(universe=universe)
	log.debug('browsing root...')
	ret = browse_ng(self.wymedia_resource, 0, 100, self._sort, options)
	log.debug('converting result...')
	wm_obj = list(WMedia2MMIObjects(ret, menu, self))
	if 'sysfuck' in plugins:
		wm_obj = list(reversed(wm_obj))
	if 'video' in universe:
		if 'youtube' in plugins:
			wm_obj.append(YouTubeContainer(parent=self, menu=self.menu))
		if 'dailymotion' in plugins:
			wm_obj.append(DailyMotionContainer(parent=self, menu=self.menu))

def show_menu(self):
	pygui_globs['menustack'].back_one_menu()

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75c2fcc>}
nname: 94
n 94(None)[]:
	i: 0(AL), 93()
	o: 

nname: 93
n 93(None)[]:
	i: 31(AF), 89()
	o: 94()

nname: 89
n 89(None)[]:
	i: 41(f), 56()
	o: 93()

nname: 56
n 56(None)[log.info('%s not in HiddenRoot. Creating it.', folder)
self.vfs_mkdir(folder)
continue
]:
	i: 41(t)
	o: 89()

nname: 41
n 41(folder not in self)[for folder in (TV_FAVORITES_FOLDER,):
]:
	i: 31(for)
	o: 56(t), 89(f)

nname: 31
n 31(None)[]:
	i: 0(loop)
	o: 41(for), 93(AF)

nname: 0
n 0(None)[DirItem.__init__(self, get_root('hidden'), type_='hidden_root')
]:
	i: 
	o: 31(loop), 94(AL)

nname: 94
n 94(None)[]:
	i: 0(AL), 31(AF), 41()
	o: 

nname: 41
n 41(None)[for folder in (TV_FAVORITES_FOLDER,):
if folder not in self:
	log.info('%s not in HiddenRoot. Creating it.', folder)
	self.vfs_mkdir(folder)
	continue
]:
	i: 31(for)
	o: 94()

nname: 31
n 31(None)[]:
	i: 0(loop)
	o: 41(for), 94(AF)

nname: 0
n 0(None)[DirItem.__init__(self, get_root('hidden'), type_='hidden_root')
]:
	i: 
	o: 31(loop), 94(AL)

nname: 41
n 41(None)[for folder in (TV_FAVORITES_FOLDER,):
	if folder not in self:
		log.info('%s not in HiddenRoot. Creating it.', folder)
		self.vfs_mkdir(folder)
		continue
]:
	i: 0(for)
	o: 

nname: 0
n 0(None)[DirItem.__init__(self, get_root('hidden'), type_='hidden_root')
]:
	i: 
	o: 41(for)

nname: 0
n 0(None)[DirItem.__init__(self, get_root('hidden'), type_='hidden_root')
for folder in (TV_FAVORITES_FOLDER,):
	if folder not in self:
		log.info('%s not in HiddenRoot. Creating it.', folder)
		self.vfs_mkdir(folder)
		continue
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b950c>}
nname: 0
n 0(None)[return WindowedItemList(self, menu, universe, sort_order=sort_order)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b93ec>}
nname: 6
n 6(None)[__doc__ = 'The root of all hidden items.\n\n    The HiddenRoot is a VFS structure for things that are saved in the\n    wymedia database but have no physical existence on the hard drive.\n\n    The HiddenRoot is guaranteed to contain the following subcontainers:\n        - TV Favorites\n    '
__metaclass__ = MetaSingleton
parent = None
def __init__(self):
	DirItem.__init__(self, get_root('hidden'), type_='hidden_root')
	for folder in (TV_FAVORITES_FOLDER,):
		if folder not in self:
			log.info('%s not in HiddenRoot. Creating it.', folder)
			self.vfs_mkdir(folder)
			continue

def browse(self, universe=None, menu=None, sort_order=None):
	return WindowedItemList(self, menu, universe, sort_order=sort_order)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75c2eac>}
nname: 171
n 171(None)[ni = klass(wm_obj)
ni.menu = menu
ni.parent = parent
ni.display_type = display_prefix + ni.type
return ni
]:
	i: 43(AL), 169()
	o: 

nname: 169
n 169(None)[]:
	i: 56(f), 166()
	o: 171()

nname: 166
n 166(None)[]:
	i: 164(AE)
	o: 169()

nname: 164
n 164(None)[]:
	i: 127(f), 137()
	o: 166(AE)

nname: 137
n 137(None)[raise TypeError('Unknown object type: %s' % wm_obj['class'])
continue
]:
	i: 127(t)
	o: 164()

nname: 127
n 127(<dummy_ex3> EXC_MATCH ValueError)[]:
	i: 96(except), 99()
	o: 137(t), 164(f)

nname: 99
n 99(None)[wm_class, stripped = wm_class.rsplit('.', 1)
continue
]:
	i: 96(try)
	o: 127()

nname: 96
n 96(None)[]:
	i: 90(), 95()
	o: 99(try), 127(except)

nname: 95
n 95(None)[]:
	i: 62(f)
	o: 96()

nname: 90
n 90(None)[break
]:
	i: 62(t)
	o: 96()

nname: 62
n 62(klass is not None)[klass = wmedia_types.get(wm_class)
]:
	i: 56(t)
	o: 90(t), 95(f)

nname: 56
n 56(True)[]:
	i: 43(loop)
	o: 62(t), 169(f)

nname: 43
n 43(None)[wm_class = wm_obj['class']
]:
	i: 28(), 42()
	o: 56(loop), 171(AL)

nname: 42
n 42(None)[]:
	i: 0(f)
	o: 43()

nname: 28
n 28(None)[display_prefix = display_prefix[6:]
]:
	i: 0(t)
	o: 43()

nname: 0
n 0(display_prefix.startswith('marker'))[display_prefix = menu.type + '_'
]:
	i: 
	o: 28(t), 42(f)

nname: 171
n 171(None)[ni = klass(wm_obj)
ni.menu = menu
ni.parent = parent
ni.display_type = display_prefix + ni.type
return ni
]:
	i: 0(AL), 56(f), 164(AE)
	o: 

nname: 164
n 164(None)[]:
	i: 99(f)
	o: 171(AE)

nname: 99
n 99(None)[try:
	wm_class, stripped = wm_class.rsplit('.', 1)
	continue
except ValueError:
	raise TypeError('Unknown object type: %s' % wm_obj['class'])
	continue
]:
	i: 62(try)
	o: 164()

nname: 62
n 62(None)[klass = wmedia_types.get(wm_class)
if klass is not None:
	break
]:
	i: 56(t)
	o: 99(try)

nname: 56
n 56(True)[]:
	i: 0(loop)
	o: 62(t), 171(f)

nname: 0
n 0(None)[display_prefix = menu.type + '_'
if display_prefix.startswith('marker'):
	display_prefix = display_prefix[6:]
wm_class = wm_obj['class']
]:
	i: 
	o: 56(loop), 171(AL)

nname: 171
n 171(None)[ni = klass(wm_obj)
ni.menu = menu
ni.parent = parent
ni.display_type = display_prefix + ni.type
return ni
]:
	i: 0(AL), 56(f), 164(AE)
	o: 

nname: 164
n 164(None)[]:
	i: 62(f)
	o: 171(AE)

nname: 62
n 62(None)[klass = wmedia_types.get(wm_class)
if klass is not None:
	break
try:
	wm_class, stripped = wm_class.rsplit('.', 1)
	continue
except ValueError:
	raise TypeError('Unknown object type: %s' % wm_obj['class'])
	continue
]:
	i: 56(t)
	o: 164()

nname: 56
n 56(True)[]:
	i: 0(loop)
	o: 62(t), 171(f)

nname: 0
n 0(None)[display_prefix = menu.type + '_'
if display_prefix.startswith('marker'):
	display_prefix = display_prefix[6:]
wm_class = wm_obj['class']
]:
	i: 
	o: 56(loop), 171(AL)

nname: 171
n 171(None)[ni = klass(wm_obj)
ni.menu = menu
ni.parent = parent
ni.display_type = display_prefix + ni.type
return ni
]:
	i: 0(AL), 56(f), 62(AE)
	o: 

nname: 62
n 62(None)[klass = wmedia_types.get(wm_class)
if klass is not None:
	break
try:
	wm_class, stripped = wm_class.rsplit('.', 1)
	continue
except ValueError:
	raise TypeError('Unknown object type: %s' % wm_obj['class'])
	continue
]:
	i: 56(t)
	o: 171(AE)

nname: 56
n 56(True)[]:
	i: 0(loop)
	o: 62(t), 171(f)

nname: 0
n 0(None)[display_prefix = menu.type + '_'
if display_prefix.startswith('marker'):
	display_prefix = display_prefix[6:]
wm_class = wm_obj['class']
]:
	i: 
	o: 56(loop), 171(AL)

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b9b2c>, 171: <unpyclib.structure.node instance at 0xb75b982c>, 56: <unpyclib.structure.node instance at 0xb75b99ac>, 62: <unpyclib.structure.node instance at 0xb75b95cc>}
nname: 60
n 60(None)[]:
	i: 0(AL), 59()
	o: 

nname: 59
n 59(None)[]:
	i: 3(AF), 56()
	o: 60()

nname: 56
n 56(None)[]:
	i: 54(AE)
	o: 59()

nname: 54
n 54(None)[]:
	i: 37(f), 47()
	o: 56(AE)

nname: 47
n 47(None)[continue
]:
	i: 37(t)
	o: 54()

nname: 37
n 37(<dummy_ex3> EXC_MATCH TypeError)[]:
	i: 10(except), 16()
	o: 47(t), 54(f)

nname: 16
n 16(None)[yield get_mmi_object(i, menu, parent)
continue
]:
	i: 10(try)
	o: 37()

nname: 10
n 10(None)[for i in iterable:
]:
	i: 3(for)
	o: 16(try), 37(except)

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 10(for), 59(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 60(AL)

nname: 60
n 60(None)[]:
	i: 0(AL), 3(AF), 37(AE)
	o: 

nname: 37
n 37(None)[except TypeError:
	continue
]:
	i: 10()
	o: 60(AE)

nname: 10
n 10(None)[for i in iterable:
try:
	yield get_mmi_object(i, menu, parent)
	continue
]:
	i: 3(for)
	o: 37()

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 10(for), 60(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 60(AL)

nname: 60
n 60(None)[]:
	i: 0(AL), 3(AF), 10(AE)
	o: 

nname: 10
n 10(None)[for i in iterable:
try:
	yield get_mmi_object(i, menu, parent)
	continue
except TypeError:
	continue
]:
	i: 3(for)
	o: 60(AE)

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 10(for), 60(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 60(AL)

nname: 60
n 60(None)[]:
	i: 10(AE)
	o: 

nname: 10
n 10(None)[for i in iterable:
	try:
		yield get_mmi_object(i, menu, parent)
		continue
	except TypeError:
		continue
]:
	i: 0(for)
	o: 60(AE)

nname: 0
n 0(None)[]:
	i: 
	o: 10(for)

nname: 60
n 60(None)[]:
	i: 0(AE)
	o: 

nname: 0
n 0(None)[for i in iterable:
	try:
		yield get_mmi_object(i, menu, parent)
		continue
	except TypeError:
		continue
]:
	i: 
	o: 60(AE)

self.nodes: {0: <unpyclib.structure.node instance at 0xb75c2fac>, 60: <unpyclib.structure.node instance at 0xb75b906c>}
nname: 0
n 0(None)[return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75c206c>}
nname: 0
n 0(None)[return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75c20cc>}
nname: 0
n 0(None)[return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75c20ec>}
nname: 0
n 0(None)[return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75c208c>}
nname: 0
n 0(None)[return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75c282c>}
nname: 599
n 599(None)[from .audiovideo import AudioItem, DVDItem, ImageItem, IsoDVDItem, VideoItem, TVRecordItem
from .audiovideo import YouTubeContainer, DailyMotionContainer, UpnpDirItem, UsbDirItem
from .net import NetDirItem, NetFeedItem, NetItem
wmedia_types = {'object.item.epgItem': ProgramItem, 'object.item.epgItem.dummy': ProgramItem, 'object.item.videoItem.videoBroadcast': ChannelItem, 'object.item.videoItem.videoBroadcast.videoCapture': CaptureChannelItem, 'object.item.videoItem.dvd': DVDItem, 'object.item.videoItem.isoDvd': IsoDVDItem, 'object.item.textItem.subtitle': SubtitleItem, 'object.container.playlistContainer': Playlist, 'object.item.netItem': NetItem, 'object.item.netItem.audio': AudioItem, 'object.item.netItem.video': VideoItem, 'object.item.netItem.image': ImageItem, 'object.item.audioItem': AudioItem, 'object.item.videoItem': VideoItem, 'object.item.videoItem.tvRecord': TVRecordItem, 'object.item.imageItem': ImageItem, 'object.container.netDir': NetDirItem, 'object.container.netFeed': NetFeedItem, 'object.container.storageSystem': DirItem, 'object.container.storageSystem.upnpStorage': UpnpDirItem, 'object.container.storageVolume': UsbDirItem, 'object.container': DirItem, 'object.item': MediaItem}
]:
	i: 529(), 573()
	o: 

nname: 573
n 573(None)[def ChannelItem():
	return None

def CaptureChannelItem():
	return None

def ProgramItem():
	return None

def TVRootItem():
	return None

def AllChannelsList():
	return None

]:
	i: 0(f)
	o: 599()

nname: 529
n 529(None)[from .tv import ChannelItem, CaptureChannelItem, ProgramItem, TVRootItem, AllChannelsList
]:
	i: 0(t)
	o: 599()

nname: 0
n 0('tv' in plugins)[from __future__ import absolute_import
__all__ = ['MediaItem', 'AudioItem', 'ImageItem', 'VideoItem', 'DVDItem', 'IsoDVDItem', 'DirItem', 'ChannelItem', 'ProgramItem', 'TVRootItem', 'Playlist', 'WMedia2MMIObjects']
from ..containers import GenericContainer
from ..core import Item
from peewee.debug import GET_LOGGER, PRINT_EXCEPTION
from peewee.misc_utils import MetaSingleton
from pygui.config import plugins, user_config
from pygui.shared import pygui_globs
from wymedia.wmplus import get_root, browse_ng, get_subtitles, create_container, object_remove, playlist_create, playlist_append_child, container_search, get_child_count, get_metadata, set_metadata, playlist_append_marker_list, playlist_append_container, playlist_clear, register_update_callback, unregister_update_callback, get_object, FreeSpaceCriticalError
from peewee.notifier import Task
log = GET_LOGGER(__name__)
UNICODE_METADATA_FIELDS = frozenset(['title', 'description', 'author'])
TV_FAVORITES_FOLDER = 'TV Favorites'
class MediaItem(Item):
	__doc__ = '\n    This is the base item for every media, could be considered virtual\n    All of those items are build from wymedia\n    '
	npl_dict = dict()
	media_update_fields = ()
	def __init__(self, wymedia_resource=None, type_=None, menu=None, display_type=None, parent=None, **meta_infos):
		valid_wymedia_obj = False
		self._observers = set()
		self._metadata_handle = None
		if wymedia_resource is None:
			wymedia_resource = 'Unnamed'
		if isinstance(wymedia_resource, basestring):
			name = wymedia_resource
		else:
			if 'i18n' in wymedia_resource:
				name = _(wymedia_resource['title'])
			else:
				if wymedia_resource['title']:
					name = wymedia_resource['title'].decode('utf-8', 'ignore')
				else:
					name = _('Untitled')
			valid_wymedia_obj = True
		if not type_:
			pass
		Item.__init__(self, name=name, type_=type_, menu=menu, display_type=display_type, parent=parent)
		if valid_wymedia_obj:
			self.wymedia_resource = wymedia_resource
			self.infos = None
		else:
			self.wymedia_resource = None
			self.infos = dict(uri='unknown://void', duration=0)
			if meta_infos:
				self.infos.update(meta_infos)
		self._update_received_task = Task(self._update_received)
		self._async_media_update_task = Task(self._async_media_update)
		self._async_media_update_task.delay = 0
		self._async_media_update_task._considered_idle = True
		self.async_media_update = self._async_media_update_task.start
		return None

	def __repr__(self):
		if self.wymedia_resource:
			return '<%s::%s(%s):%s>' % (self.__class__.__name__, self.type, repr(self.name), self.wymedia_resource.get('id', 'unknown'))
		else:
			return Item.__repr__(self)

	def _get_parent(self):
		if not self._parent:
			if self.wymedia_resource and self['parentid']:
				if int(self['parentid']) == 0:
					self._parent = RootItem()
				else:
					wm_parent = get_object(self['parentid'], ('uri', 'class', 'title'))
					self._parent = get_mmi_object(wm_parent, self.menu, None)
		return self._parent

	def _set_parent(self, item):
		self._parent = item

	parent = property(_get_parent, _set_parent)
	del _get_parent
	del _set_parent
	wpl_options = property()
	def is_marked(self):
		try:
			return bool(self.wymedia_resource.get('marked'))
		except AttributeError:
			return False

	def vfs_set_metas(self, _unref_link=False, **kw):
		log.debug('Setting %s to %s', kw, self)
		if not self.wymedia_resource:
			pass
		if _unref_link:
			self.wymedia_resource.update(kw)
			kw['id'] = self.wymedia_resource['refid']
			try:
				set_metadata(kw)
			except:
				log.error('set_metadata %s on %s failed!', kw, self)
				PRINT_EXCEPTION()
		else:
			for key, value in kw.iteritems():
				try:
					self[key] = value
					continue
				except:
					log.debug('setting %s[%s]=%s Failed', self, key, value)
					PRINT_EXCEPTION()
					continue

	def vfs_rename(self, new_name):
		self['title'] = new_name.encode('utf-8')
		self.name = new_name

	def vfs_delete(self):
		object_remove(self.wymedia_resource, {'universe': self.universe})

	def handle_update(self, *args):
		self._update_received_task.args = args
		self._update_received_task.start(0, consider_idle=True)

	def watch(self, observer):
		log.info('%s by %s', self, observer)
		if self.wymedia_resource is not None:
			self._observers.add(observer)
			self.async_media_update()
		return None

	def unwatch(self, observer=None):
		log.info('%s by %s', self, observer)
		if self.wymedia_resource is not None:
			if observer is None:
				self._observers = set()
			else:
				self._observers.discard(observer)
			if not self._observers:
				log.info('unregister %s', self)
				unregister_update_callback(self.wymedia_resource)
		return None

	watched = property((lambda self: bool(self._observers)))
	def _async_media_update(self):
		if self.wymedia_resource is not None and not self._metadata_handle:
			log.info(self)
			register_update_callback(self.wymedia_resource, self.handle_update)
			get_metadata(self.wymedia_resource)
			self._metadata_handle = True
		return None

	def _update_received(self, infos, kind):
		log.info(self)
		log.debug('%s infos=%s', self, infos)
		try:
			if 'title' in infos:
				if 'i18n' in infos:
					self.name = _(infos['title'])
				else:
					self.name = infos['title'].decode('utf-8')
			self.wymedia_resource.update(infos)

	def media_update(self, *names):
		if self.wymedia_resource is not None:
			wm_resource = None
			if not(names or self.media_update_fields):
				pass
			wanted_attr = names
			if wanted_attr:
				log.debug('%s %s', self, wanted_attr)
				wm_resource = get_object(self['id'], wanted_attr)
				if wm_resource:
					if 'title' in wm_resource:
						if 'i18n' in wm_resource:
							self.name = _(wm_resource['title'])
						else:
							self.name = wm_resource['title'].decode('utf-8')
					index = self.wymedia_resource.get('index', None)
					if index is not None:
						wm_resource['index'] = index
					self.wymedia_resource.update(wm_resource)
		return None

	def __getitem__(self, name):
		try:
			pass
		if self.wymedia_resource is not None:
			if name == 'subtitles':
				return list(WMedia2MMIObjects(get_subtitles(self.wymedia_resource), self.menu, self))
			else:
				if name == 'thumbnail':
					tn = self.wymedia_resource.get('preview')
					if tn is None:
						if hasattr(self.menu, '_thumbnail_updated'):
							self.watch(self.menu._thumbnail_updated)
						else:
							self.async_media_update()
					return tn
			data = self.wymedia_resource[name]
			if name in UNICODE_METADATA_FIELDS:
				return data.decode('utf-8')
			else:
				return data
		else:
			res = self.infos.get(name)
			if callable(res):
				res, self.infos[name] = res(), res()
			return res

	def __setitem__(self, name, value):
		if self.wymedia_resource is not None:
			if name not in ('subtitles', 'thumbnail', 'preview'):
				self.wymedia_resource[name] = value
				log.debug('wymedia.set_metadata(id: %s  %s: %s)', self.wymedia_resource['id'], name, value)
				set_metadata({'id': self.wymedia_resource['id'], name: value})
		else:
			self.infos[name] = value
		return None

	def execute(self, *args, **args):
		try:
			self.player.play(self, *args, **kw)
		except Exception, e:
			PRINT_EXCEPTION(e)

	def __hash__(self):
		if self.wymedia_resource is None:
			return hash(self.name + self.type + self['uri'])
		return hash(self.wymedia_resource['id'])

	def __eq__(self, other):
		if hasattr(other, 'wymedia_resource'):
			if self.wymedia_resource is None or other.wymedia_resource is None:
				return self.name + self.type == other.name + other.type
			return self.wymedia_resource['id'] == other.wymedia_resource['id']
		else:
			if isinstance(other, dict) and 'id' in other:
				return self.wymedia_resource['id'] == other['id']
		return None

	def __ne__(self, other):
		return not self == other

	def __cmp__(self, other):
		if isinstance(other, MediaItem):
			if self.wymedia_resource is None or other.wymedia_resource is None:
				return cmp(self.name + self.type, other.name + other.type)
			return cmp(self.wymedia_resource['id'], other.wymedia_resource['id'])
		else:
			if isinstance(other, dict) and 'id' in other:
				return cmp(self.wymedia_resource['id'], other['id'])
			else:
				return cmp(type(self), type(other))
		return None

	def _npl_decision(self, *args, **args):
		if 'playone' in plugins:
			return self.player.play(self, **kw)
		ms = pygui_globs['menustack']
		ms.back_to_menu(self.menu)
		player = ms.get_player()
		if self.universe == 'multiverse':
			try:
				self.player.play(self, **kw)
			except AttributeError:
				pass
			except:
				PRINT_EXCEPTION()
			return None
		name = self.universe + ':npl'
		if name not in MediaItem.npl_dict:
			wmedia_pls = playlist_create(get_root(), name)
			MediaItem.npl_dict[name] = get_mmi_object(wmedia_pls, self.menu, None)
		pl = MediaItem.npl_dict[name]
		if isinstance(self, GenericContainer):
			item_to_add = self
			item_to_start = None
		else:
			item_to_add = self.parent
			item_to_start = self
		log.debug('NPL: pl=%s to_add=%s to_start=%s', pl, item_to_add, item_to_start)
		if player is None:
			log.debug('NPL: no running player')
			pl.vfs_clear()
			pl.menu = self.menu
			pl.vfs_add_item(item_to_add)
			pl.play(item_to_start, **kw)
		else:
			log.debug('NPL: player found ask for add/replace')
			def _replace():
				pl.vfs_clear()
				pl.vfs_add_item(item_to_add)
				pl.play(item_to_start, **kw)

			def _add():
				if isinstance(self, GenericContainer):
					player.get_item_list('main_list').extend(self.browse())
				else:
					player.get_item_list('main_list').append(self)
				player.song_changed()
				if player.random_mode:
					player.random_mode = False
					player.go_random()

			if self.universe == 'audio':
				from pygui.window import ConfirmWindow, Button
				cw = ConfirmWindow(_('Add to now playing or play this item ?'), buttons=[Button(_('Add'), True), Button(_('Replace'), False)])
				cw.buttons[0].connect(_add)
				cw.buttons[1].connect(_replace)
				cw.show()
			else:
				_replace()
		return None



class DirItem(MediaItem, GenericContainer):
	__doc__ = ' Item representing directory '
	def __init__(self, wymedia_resource, type_='dir', **kw):
		MediaItem.__init__(self, wymedia_resource, type_=type_, **kw)

	def vfs_mkdir(self, name):
		create_container(self.wymedia_resource, name)

	def browse(self, sort_order=None):
		return WindowedItemList(self, menu=self.menu, universe=self.universe, sort_order=sort_order)

	def execute(self):
		self._npl_decision()

	def get_free_child_name(self, prefix):
		if prefix not in self:
			return prefix
		prefix += '-'

	def get_child(self, name, menu=None):
		result_set = container_search(self.wymedia_resource, 'title', name)
		if result_set:
			if len(result_set) > 1:
				log.warn("Query for '%s' returned more than 1 child.", name)
			if not menu:
				pass
			return get_mmi_object(result_set[0], menu, self)
		else:
			raise KeyError("No such child: '%s'" % name)

	def get_child_count(self):
		try:
			return get_child_count(self.wymedia_resource, dict(universe=self.universe))
		except:
			log.warn('%s does not support get_child_count()', self)

	def __contains__(self, name):
		return bool(container_search(self.wymedia_resource, 'title', name))



class Playlist(DirItem):
	__doc__ = ' Playlist object, launch an editor on browse() (see browse_action) '
	def __init__(self, wymedia_resource, type_='playlist', **kw):
		MediaItem.__init__(self, wymedia_resource, type_=type_, **kw)

	def play(self, starts_with=None, **kw):
		log.debug('%s.play(starts_with=%s)', self, starts_with)
		items = self.browse()
		if starts_with is None:
			for it in items:
				if hasattr(it, 'player'):
					it.player.play(it, playlist=items, **kw)
					break
					continue
			else:
				log.info('Nothing to play here')
		else:
			starts_with.player.play(starts_with, playlist=items, **kw)
		return None

	def execute(self):
		from pygui.markerlist import Markerlist
		if self == Markerlist.now_playing:
			log.debug("Can't play Now Playing List !")
		DirItem.execute(self)

	def browse_action(self):
		from pygui.markerlist import Markerlist
		if self == Markerlist.now_playing:
			log.error("Can't edit Now Playing List!")
		if self['mimeType'] == 'audio/mpegurl':
			log.error("Can't edit M3U playlist!")
		if self['backend'] == 'upnp':
			log.error("Can't edit remote playlist!")
		from pygui.menu.menu import PlaylistEditor
		PlaylistEditor(playlist=self, universe=self.menu.universe).show(hide_previous_menu=False)

	def vfs_add_item(self, item):
		if isinstance(item, DirItem):
			from pygui.config import admin_age
			browse_options = dict(universe=self.universe)
			if user_config['security']['parental_control']:
				if not user_config['security']['parent_mode']:
					if not user_config['security']['maturity_rating']:
						pass
					maturity_rating = user_config['security']['maturity_rating']
					browse_options['maturity_rating'] = str(maturity_rating)
				else:
					if user_config['security']['show_hidden']:
						pass
					maturity_rating = 19
					browse_options['maturity_rating'] = str(maturity_rating)
			return playlist_append_container(self.wymedia_resource, item.wymedia_resource, wymedia_sorting, browse_options)
		if isinstance(item, Item):
			return playlist_append_child(self.wymedia_resource, item.wymedia_resource)
		if not isinstance(item, dict):
			return playlist_append_marker_list(self.wymedia_resource, item.wymedia_resource)
		else:
			return playlist_append_child(self.wymedia_resource, item)

	def vfs_clear(self):
		playlist_clear(self.wymedia_resource)

	def vfs_del_item(self, item):
		if isinstance(item, Item):
			item = item.wymedia_resource
		children = container_search(self.wymedia_resource, 'refid', item['id'])
		if not children:
			raise ValueError('Playlist.vfs_del_item(x): x not in playlist')
		object_remove(children[0], {'universe': self.universe})



class RootItem(MediaItem, GenericContainer):
	__doc__ = ' The root item, mother of every item '
	__metaclass__ = MetaSingleton
	parent = property((lambda self: None), (lambda self, val: None))
	def __init__(self):
		from wymedia.wmplus import init
		log.debug('Root::init')
		try:
			init()
		except FreeSpaceCriticalError:
			log.debug('No space left on device')
		log.debug('Root::get')
		egg = get_root()
		self._sort = ['family'] + list(wymedia_sorting)
		MediaItem.__init__(self, egg, type_='root')
		pygui_globs['db_root'] = self

	def browse(self, universe='main', menu=None):
		if universe == 'multiverse':
			options = dict()
		else:
			options = dict(universe=universe)
		log.debug('browsing root...')
		ret = browse_ng(self.wymedia_resource, 0, 100, self._sort, options)
		log.debug('converting result...')
		wm_obj = list(WMedia2MMIObjects(ret, menu, self))
		if 'sysfuck' in plugins:
			wm_obj = list(reversed(wm_obj))
		if 'video' in universe:
			if 'youtube' in plugins:
				wm_obj.append(YouTubeContainer(parent=self, menu=self.menu))
			if 'dailymotion' in plugins:
				wm_obj.append(DailyMotionContainer(parent=self, menu=self.menu))

	def show_menu(self):
		pygui_globs['menustack'].back_one_menu()



class HiddenRoot(DirItem):
	__doc__ = 'The root of all hidden items.\n\n    The HiddenRoot is a VFS structure for things that are saved in the\n    wymedia database but have no physical existence on the hard drive.\n\n    The HiddenRoot is guaranteed to contain the following subcontainers:\n        - TV Favorites\n    '
	__metaclass__ = MetaSingleton
	parent = None
	def __init__(self):
		DirItem.__init__(self, get_root('hidden'), type_='hidden_root')
		for folder in (TV_FAVORITES_FOLDER,):
			if folder not in self:
				log.info('%s not in HiddenRoot. Creating it.', folder)
				self.vfs_mkdir(folder)
				continue

	def browse(self, universe=None, menu=None, sort_order=None):
		return WindowedItemList(self, menu, universe, sort_order=sort_order)



wymedia_sorting = ('container', 'title')
def get_mmi_object(wm_obj, menu, parent):
	display_prefix = menu.type + '_'
	if display_prefix.startswith('marker'):
		display_prefix = display_prefix[6:]
	wm_class = wm_obj['class']

def WMedia2MMIObjects(iterable, menu, parent):
	for i in iterable:
		try:
			yield get_mmi_object(i, menu, parent)
			continue
		except TypeError:
			continue

from .progressive_result import WindowedItemList
from .misc import SubtitleItem
]:
	i: 
	o: 529(t), 573(f)

nname: 0
n 0(None)[from __future__ import absolute_import
__all__ = ['MediaItem', 'AudioItem', 'ImageItem', 'VideoItem', 'DVDItem', 'IsoDVDItem', 'DirItem', 'ChannelItem', 'ProgramItem', 'TVRootItem', 'Playlist', 'WMedia2MMIObjects']
from ..containers import GenericContainer
from ..core import Item
from peewee.debug import GET_LOGGER, PRINT_EXCEPTION
from peewee.misc_utils import MetaSingleton
from pygui.config import plugins, user_config
from pygui.shared import pygui_globs
from wymedia.wmplus import get_root, browse_ng, get_subtitles, create_container, object_remove, playlist_create, playlist_append_child, container_search, get_child_count, get_metadata, set_metadata, playlist_append_marker_list, playlist_append_container, playlist_clear, register_update_callback, unregister_update_callback, get_object, FreeSpaceCriticalError
from peewee.notifier import Task
log = GET_LOGGER(__name__)
UNICODE_METADATA_FIELDS = frozenset(['title', 'description', 'author'])
TV_FAVORITES_FOLDER = 'TV Favorites'
class MediaItem(Item):
	__doc__ = '\n    This is the base item for every media, could be considered virtual\n    All of those items are build from wymedia\n    '
	npl_dict = dict()
	media_update_fields = ()
	def __init__(self, wymedia_resource=None, type_=None, menu=None, display_type=None, parent=None, **meta_infos):
		valid_wymedia_obj = False
		self._observers = set()
		self._metadata_handle = None
		if wymedia_resource is None:
			wymedia_resource = 'Unnamed'
		if isinstance(wymedia_resource, basestring):
			name = wymedia_resource
		else:
			if 'i18n' in wymedia_resource:
				name = _(wymedia_resource['title'])
			else:
				if wymedia_resource['title']:
					name = wymedia_resource['title'].decode('utf-8', 'ignore')
				else:
					name = _('Untitled')
			valid_wymedia_obj = True
		if not type_:
			pass
		Item.__init__(self, name=name, type_=type_, menu=menu, display_type=display_type, parent=parent)
		if valid_wymedia_obj:
			self.wymedia_resource = wymedia_resource
			self.infos = None
		else:
			self.wymedia_resource = None
			self.infos = dict(uri='unknown://void', duration=0)
			if meta_infos:
				self.infos.update(meta_infos)
		self._update_received_task = Task(self._update_received)
		self._async_media_update_task = Task(self._async_media_update)
		self._async_media_update_task.delay = 0
		self._async_media_update_task._considered_idle = True
		self.async_media_update = self._async_media_update_task.start
		return None

	def __repr__(self):
		if self.wymedia_resource:
			return '<%s::%s(%s):%s>' % (self.__class__.__name__, self.type, repr(self.name), self.wymedia_resource.get('id', 'unknown'))
		else:
			return Item.__repr__(self)

	def _get_parent(self):
		if not self._parent:
			if self.wymedia_resource and self['parentid']:
				if int(self['parentid']) == 0:
					self._parent = RootItem()
				else:
					wm_parent = get_object(self['parentid'], ('uri', 'class', 'title'))
					self._parent = get_mmi_object(wm_parent, self.menu, None)
		return self._parent

	def _set_parent(self, item):
		self._parent = item

	parent = property(_get_parent, _set_parent)
	del _get_parent
	del _set_parent
	wpl_options = property()
	def is_marked(self):
		try:
			return bool(self.wymedia_resource.get('marked'))
		except AttributeError:
			return False

	def vfs_set_metas(self, _unref_link=False, **kw):
		log.debug('Setting %s to %s', kw, self)
		if not self.wymedia_resource:
			pass
		if _unref_link:
			self.wymedia_resource.update(kw)
			kw['id'] = self.wymedia_resource['refid']
			try:
				set_metadata(kw)
			except:
				log.error('set_metadata %s on %s failed!', kw, self)
				PRINT_EXCEPTION()
		else:
			for key, value in kw.iteritems():
				try:
					self[key] = value
					continue
				except:
					log.debug('setting %s[%s]=%s Failed', self, key, value)
					PRINT_EXCEPTION()
					continue

	def vfs_rename(self, new_name):
		self['title'] = new_name.encode('utf-8')
		self.name = new_name

	def vfs_delete(self):
		object_remove(self.wymedia_resource, {'universe': self.universe})

	def handle_update(self, *args):
		self._update_received_task.args = args
		self._update_received_task.start(0, consider_idle=True)

	def watch(self, observer):
		log.info('%s by %s', self, observer)
		if self.wymedia_resource is not None:
			self._observers.add(observer)
			self.async_media_update()
		return None

	def unwatch(self, observer=None):
		log.info('%s by %s', self, observer)
		if self.wymedia_resource is not None:
			if observer is None:
				self._observers = set()
			else:
				self._observers.discard(observer)
			if not self._observers:
				log.info('unregister %s', self)
				unregister_update_callback(self.wymedia_resource)
		return None

	watched = property((lambda self: bool(self._observers)))
	def _async_media_update(self):
		if self.wymedia_resource is not None and not self._metadata_handle:
			log.info(self)
			register_update_callback(self.wymedia_resource, self.handle_update)
			get_metadata(self.wymedia_resource)
			self._metadata_handle = True
		return None

	def _update_received(self, infos, kind):
		log.info(self)
		log.debug('%s infos=%s', self, infos)
		try:
			if 'title' in infos:
				if 'i18n' in infos:
					self.name = _(infos['title'])
				else:
					self.name = infos['title'].decode('utf-8')
			self.wymedia_resource.update(infos)

	def media_update(self, *names):
		if self.wymedia_resource is not None:
			wm_resource = None
			if not(names or self.media_update_fields):
				pass
			wanted_attr = names
			if wanted_attr:
				log.debug('%s %s', self, wanted_attr)
				wm_resource = get_object(self['id'], wanted_attr)
				if wm_resource:
					if 'title' in wm_resource:
						if 'i18n' in wm_resource:
							self.name = _(wm_resource['title'])
						else:
							self.name = wm_resource['title'].decode('utf-8')
					index = self.wymedia_resource.get('index', None)
					if index is not None:
						wm_resource['index'] = index
					self.wymedia_resource.update(wm_resource)
		return None

	def __getitem__(self, name):
		try:
			pass
		if self.wymedia_resource is not None:
			if name == 'subtitles':
				return list(WMedia2MMIObjects(get_subtitles(self.wymedia_resource), self.menu, self))
			else:
				if name == 'thumbnail':
					tn = self.wymedia_resource.get('preview')
					if tn is None:
						if hasattr(self.menu, '_thumbnail_updated'):
							self.watch(self.menu._thumbnail_updated)
						else:
							self.async_media_update()
					return tn
			data = self.wymedia_resource[name]
			if name in UNICODE_METADATA_FIELDS:
				return data.decode('utf-8')
			else:
				return data
		else:
			res = self.infos.get(name)
			if callable(res):
				res, self.infos[name] = res(), res()
			return res

	def __setitem__(self, name, value):
		if self.wymedia_resource is not None:
			if name not in ('subtitles', 'thumbnail', 'preview'):
				self.wymedia_resource[name] = value
				log.debug('wymedia.set_metadata(id: %s  %s: %s)', self.wymedia_resource['id'], name, value)
				set_metadata({'id': self.wymedia_resource['id'], name: value})
		else:
			self.infos[name] = value
		return None

	def execute(self, *args, **args):
		try:
			self.player.play(self, *args, **kw)
		except Exception, e:
			PRINT_EXCEPTION(e)

	def __hash__(self):
		if self.wymedia_resource is None:
			return hash(self.name + self.type + self['uri'])
		return hash(self.wymedia_resource['id'])

	def __eq__(self, other):
		if hasattr(other, 'wymedia_resource'):
			if self.wymedia_resource is None or other.wymedia_resource is None:
				return self.name + self.type == other.name + other.type
			return self.wymedia_resource['id'] == other.wymedia_resource['id']
		else:
			if isinstance(other, dict) and 'id' in other:
				return self.wymedia_resource['id'] == other['id']
		return None

	def __ne__(self, other):
		return not self == other

	def __cmp__(self, other):
		if isinstance(other, MediaItem):
			if self.wymedia_resource is None or other.wymedia_resource is None:
				return cmp(self.name + self.type, other.name + other.type)
			return cmp(self.wymedia_resource['id'], other.wymedia_resource['id'])
		else:
			if isinstance(other, dict) and 'id' in other:
				return cmp(self.wymedia_resource['id'], other['id'])
			else:
				return cmp(type(self), type(other))
		return None

	def _npl_decision(self, *args, **args):
		if 'playone' in plugins:
			return self.player.play(self, **kw)
		ms = pygui_globs['menustack']
		ms.back_to_menu(self.menu)
		player = ms.get_player()
		if self.universe == 'multiverse':
			try:
				self.player.play(self, **kw)
			except AttributeError:
				pass
			except:
				PRINT_EXCEPTION()
			return None
		name = self.universe + ':npl'
		if name not in MediaItem.npl_dict:
			wmedia_pls = playlist_create(get_root(), name)
			MediaItem.npl_dict[name] = get_mmi_object(wmedia_pls, self.menu, None)
		pl = MediaItem.npl_dict[name]
		if isinstance(self, GenericContainer):
			item_to_add = self
			item_to_start = None
		else:
			item_to_add = self.parent
			item_to_start = self
		log.debug('NPL: pl=%s to_add=%s to_start=%s', pl, item_to_add, item_to_start)
		if player is None:
			log.debug('NPL: no running player')
			pl.vfs_clear()
			pl.menu = self.menu
			pl.vfs_add_item(item_to_add)
			pl.play(item_to_start, **kw)
		else:
			log.debug('NPL: player found ask for add/replace')
			def _replace():
				pl.vfs_clear()
				pl.vfs_add_item(item_to_add)
				pl.play(item_to_start, **kw)

			def _add():
				if isinstance(self, GenericContainer):
					player.get_item_list('main_list').extend(self.browse())
				else:
					player.get_item_list('main_list').append(self)
				player.song_changed()
				if player.random_mode:
					player.random_mode = False
					player.go_random()

			if self.universe == 'audio':
				from pygui.window import ConfirmWindow, Button
				cw = ConfirmWindow(_('Add to now playing or play this item ?'), buttons=[Button(_('Add'), True), Button(_('Replace'), False)])
				cw.buttons[0].connect(_add)
				cw.buttons[1].connect(_replace)
				cw.show()
			else:
				_replace()
		return None



class DirItem(MediaItem, GenericContainer):
	__doc__ = ' Item representing directory '
	def __init__(self, wymedia_resource, type_='dir', **kw):
		MediaItem.__init__(self, wymedia_resource, type_=type_, **kw)

	def vfs_mkdir(self, name):
		create_container(self.wymedia_resource, name)

	def browse(self, sort_order=None):
		return WindowedItemList(self, menu=self.menu, universe=self.universe, sort_order=sort_order)

	def execute(self):
		self._npl_decision()

	def get_free_child_name(self, prefix):
		if prefix not in self:
			return prefix
		prefix += '-'

	def get_child(self, name, menu=None):
		result_set = container_search(self.wymedia_resource, 'title', name)
		if result_set:
			if len(result_set) > 1:
				log.warn("Query for '%s' returned more than 1 child.", name)
			if not menu:
				pass
			return get_mmi_object(result_set[0], menu, self)
		else:
			raise KeyError("No such child: '%s'" % name)

	def get_child_count(self):
		try:
			return get_child_count(self.wymedia_resource, dict(universe=self.universe))
		except:
			log.warn('%s does not support get_child_count()', self)

	def __contains__(self, name):
		return bool(container_search(self.wymedia_resource, 'title', name))



class Playlist(DirItem):
	__doc__ = ' Playlist object, launch an editor on browse() (see browse_action) '
	def __init__(self, wymedia_resource, type_='playlist', **kw):
		MediaItem.__init__(self, wymedia_resource, type_=type_, **kw)

	def play(self, starts_with=None, **kw):
		log.debug('%s.play(starts_with=%s)', self, starts_with)
		items = self.browse()
		if starts_with is None:
			for it in items:
				if hasattr(it, 'player'):
					it.player.play(it, playlist=items, **kw)
					break
					continue
			else:
				log.info('Nothing to play here')
		else:
			starts_with.player.play(starts_with, playlist=items, **kw)
		return None

	def execute(self):
		from pygui.markerlist import Markerlist
		if self == Markerlist.now_playing:
			log.debug("Can't play Now Playing List !")
		DirItem.execute(self)

	def browse_action(self):
		from pygui.markerlist import Markerlist
		if self == Markerlist.now_playing:
			log.error("Can't edit Now Playing List!")
		if self['mimeType'] == 'audio/mpegurl':
			log.error("Can't edit M3U playlist!")
		if self['backend'] == 'upnp':
			log.error("Can't edit remote playlist!")
		from pygui.menu.menu import PlaylistEditor
		PlaylistEditor(playlist=self, universe=self.menu.universe).show(hide_previous_menu=False)

	def vfs_add_item(self, item):
		if isinstance(item, DirItem):
			from pygui.config import admin_age
			browse_options = dict(universe=self.universe)
			if user_config['security']['parental_control']:
				if not user_config['security']['parent_mode']:
					if not user_config['security']['maturity_rating']:
						pass
					maturity_rating = user_config['security']['maturity_rating']
					browse_options['maturity_rating'] = str(maturity_rating)
				else:
					if user_config['security']['show_hidden']:
						pass
					maturity_rating = 19
					browse_options['maturity_rating'] = str(maturity_rating)
			return playlist_append_container(self.wymedia_resource, item.wymedia_resource, wymedia_sorting, browse_options)
		if isinstance(item, Item):
			return playlist_append_child(self.wymedia_resource, item.wymedia_resource)
		if not isinstance(item, dict):
			return playlist_append_marker_list(self.wymedia_resource, item.wymedia_resource)
		else:
			return playlist_append_child(self.wymedia_resource, item)

	def vfs_clear(self):
		playlist_clear(self.wymedia_resource)

	def vfs_del_item(self, item):
		if isinstance(item, Item):
			item = item.wymedia_resource
		children = container_search(self.wymedia_resource, 'refid', item['id'])
		if not children:
			raise ValueError('Playlist.vfs_del_item(x): x not in playlist')
		object_remove(children[0], {'universe': self.universe})



class RootItem(MediaItem, GenericContainer):
	__doc__ = ' The root item, mother of every item '
	__metaclass__ = MetaSingleton
	parent = property((lambda self: None), (lambda self, val: None))
	def __init__(self):
		from wymedia.wmplus import init
		log.debug('Root::init')
		try:
			init()
		except FreeSpaceCriticalError:
			log.debug('No space left on device')
		log.debug('Root::get')
		egg = get_root()
		self._sort = ['family'] + list(wymedia_sorting)
		MediaItem.__init__(self, egg, type_='root')
		pygui_globs['db_root'] = self

	def browse(self, universe='main', menu=None):
		if universe == 'multiverse':
			options = dict()
		else:
			options = dict(universe=universe)
		log.debug('browsing root...')
		ret = browse_ng(self.wymedia_resource, 0, 100, self._sort, options)
		log.debug('converting result...')
		wm_obj = list(WMedia2MMIObjects(ret, menu, self))
		if 'sysfuck' in plugins:
			wm_obj = list(reversed(wm_obj))
		if 'video' in universe:
			if 'youtube' in plugins:
				wm_obj.append(YouTubeContainer(parent=self, menu=self.menu))
			if 'dailymotion' in plugins:
				wm_obj.append(DailyMotionContainer(parent=self, menu=self.menu))

	def show_menu(self):
		pygui_globs['menustack'].back_one_menu()



class HiddenRoot(DirItem):
	__doc__ = 'The root of all hidden items.\n\n    The HiddenRoot is a VFS structure for things that are saved in the\n    wymedia database but have no physical existence on the hard drive.\n\n    The HiddenRoot is guaranteed to contain the following subcontainers:\n        - TV Favorites\n    '
	__metaclass__ = MetaSingleton
	parent = None
	def __init__(self):
		DirItem.__init__(self, get_root('hidden'), type_='hidden_root')
		for folder in (TV_FAVORITES_FOLDER,):
			if folder not in self:
				log.info('%s not in HiddenRoot. Creating it.', folder)
				self.vfs_mkdir(folder)
				continue

	def browse(self, universe=None, menu=None, sort_order=None):
		return WindowedItemList(self, menu, universe, sort_order=sort_order)



wymedia_sorting = ('container', 'title')
def get_mmi_object(wm_obj, menu, parent):
	display_prefix = menu.type + '_'
	if display_prefix.startswith('marker'):
		display_prefix = display_prefix[6:]
	wm_class = wm_obj['class']

def WMedia2MMIObjects(iterable, menu, parent):
	for i in iterable:
		try:
			yield get_mmi_object(i, menu, parent)
			continue
		except TypeError:
			continue

from .progressive_result import WindowedItemList
from .misc import SubtitleItem
if 'tv' in plugins:
	from .tv import ChannelItem, CaptureChannelItem, ProgramItem, TVRootItem, AllChannelsList
else:
	def ChannelItem():
		return None

	def CaptureChannelItem():
		return None

	def ProgramItem():
		return None

	def TVRootItem():
		return None

	def AllChannelsList():
		return None

from .audiovideo import AudioItem, DVDItem, ImageItem, IsoDVDItem, VideoItem, TVRecordItem
from .audiovideo import YouTubeContainer, DailyMotionContainer, UpnpDirItem, UsbDirItem
from .net import NetDirItem, NetFeedItem, NetItem
wmedia_types = {'object.item.epgItem': ProgramItem, 'object.item.epgItem.dummy': ProgramItem, 'object.item.videoItem.videoBroadcast': ChannelItem, 'object.item.videoItem.videoBroadcast.videoCapture': CaptureChannelItem, 'object.item.videoItem.dvd': DVDItem, 'object.item.videoItem.isoDvd': IsoDVDItem, 'object.item.textItem.subtitle': SubtitleItem, 'object.container.playlistContainer': Playlist, 'object.item.netItem': NetItem, 'object.item.netItem.audio': AudioItem, 'object.item.netItem.video': VideoItem, 'object.item.netItem.image': ImageItem, 'object.item.audioItem': AudioItem, 'object.item.videoItem': VideoItem, 'object.item.videoItem.tvRecord': TVRecordItem, 'object.item.imageItem': ImageItem, 'object.container.netDir': NetDirItem, 'object.container.netFeed': NetFeedItem, 'object.container.storageSystem': DirItem, 'object.container.storageSystem.upnpStorage': UpnpDirItem, 'object.container.storageVolume': UsbDirItem, 'object.container': DirItem, 'object.item': MediaItem}
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75c29ac>}
from __future__ import absolute_import
__all__ = ['MediaItem', 'AudioItem', 'ImageItem', 'VideoItem', 'DVDItem', 'IsoDVDItem', 'DirItem', 'ChannelItem', 'ProgramItem', 'TVRootItem', 'Playlist', 'WMedia2MMIObjects']
from ..containers import GenericContainer
from ..core import Item
from peewee.debug import GET_LOGGER, PRINT_EXCEPTION
from peewee.misc_utils import MetaSingleton
from pygui.config import plugins, user_config
from pygui.shared import pygui_globs
from wymedia.wmplus import get_root, browse_ng, get_subtitles, create_container, object_remove, playlist_create, playlist_append_child, container_search, get_child_count, get_metadata, set_metadata, playlist_append_marker_list, playlist_append_container, playlist_clear, register_update_callback, unregister_update_callback, get_object, FreeSpaceCriticalError
from peewee.notifier import Task
log = GET_LOGGER(__name__)
UNICODE_METADATA_FIELDS = frozenset(['title', 'description', 'author'])
TV_FAVORITES_FOLDER = 'TV Favorites'
class MediaItem(Item):
	__doc__ = '\n    This is the base item for every media, could be considered virtual\n    All of those items are build from wymedia\n    '
	npl_dict = dict()
	media_update_fields = ()
	def __init__(self, wymedia_resource=None, type_=None, menu=None, display_type=None, parent=None, **meta_infos):
		valid_wymedia_obj = False
		self._observers = set()
		self._metadata_handle = None
		if wymedia_resource is None:
			wymedia_resource = 'Unnamed'
		if isinstance(wymedia_resource, basestring):
			name = wymedia_resource
		else:
			if 'i18n' in wymedia_resource:
				name = _(wymedia_resource['title'])
			else:
				if wymedia_resource['title']:
					name = wymedia_resource['title'].decode('utf-8', 'ignore')
				else:
					name = _('Untitled')
			valid_wymedia_obj = True
		if not type_:
			pass
		Item.__init__(self, name=name, type_=type_, menu=menu, display_type=display_type, parent=parent)
		if valid_wymedia_obj:
			self.wymedia_resource = wymedia_resource
			self.infos = None
		else:
			self.wymedia_resource = None
			self.infos = dict(uri='unknown://void', duration=0)
			if meta_infos:
				self.infos.update(meta_infos)
		self._update_received_task = Task(self._update_received)
		self._async_media_update_task = Task(self._async_media_update)
		self._async_media_update_task.delay = 0
		self._async_media_update_task._considered_idle = True
		self.async_media_update = self._async_media_update_task.start
		return None

	def __repr__(self):
		if self.wymedia_resource:
			return '<%s::%s(%s):%s>' % (self.__class__.__name__, self.type, repr(self.name), self.wymedia_resource.get('id', 'unknown'))
		else:
			return Item.__repr__(self)

	def _get_parent(self):
		if not self._parent:
			if self.wymedia_resource and self['parentid']:
				if int(self['parentid']) == 0:
					self._parent = RootItem()
				else:
					wm_parent = get_object(self['parentid'], ('uri', 'class', 'title'))
					self._parent = get_mmi_object(wm_parent, self.menu, None)
		return self._parent

	def _set_parent(self, item):
		self._parent = item

	parent = property(_get_parent, _set_parent)
	del _get_parent
	del _set_parent
	wpl_options = property()
	def is_marked(self):
		try:
			return bool(self.wymedia_resource.get('marked'))
		except AttributeError:
			return False

	def vfs_set_metas(self, _unref_link=False, **kw):
		log.debug('Setting %s to %s', kw, self)
		if not self.wymedia_resource:
			pass
		if _unref_link:
			self.wymedia_resource.update(kw)
			kw['id'] = self.wymedia_resource['refid']
			try:
				set_metadata(kw)
			except:
				log.error('set_metadata %s on %s failed!', kw, self)
				PRINT_EXCEPTION()
		else:
			for key, value in kw.iteritems():
				try:
					self[key] = value
					continue
				except:
					log.debug('setting %s[%s]=%s Failed', self, key, value)
					PRINT_EXCEPTION()
					continue

	def vfs_rename(self, new_name):
		self['title'] = new_name.encode('utf-8')
		self.name = new_name

	def vfs_delete(self):
		object_remove(self.wymedia_resource, {'universe': self.universe})

	def handle_update(self, *args):
		self._update_received_task.args = args
		self._update_received_task.start(0, consider_idle=True)

	def watch(self, observer):
		log.info('%s by %s', self, observer)
		if self.wymedia_resource is not None:
			self._observers.add(observer)
			self.async_media_update()
		return None

	def unwatch(self, observer=None):
		log.info('%s by %s', self, observer)
		if self.wymedia_resource is not None:
			if observer is None:
				self._observers = set()
			else:
				self._observers.discard(observer)
			if not self._observers:
				log.info('unregister %s', self)
				unregister_update_callback(self.wymedia_resource)
		return None

	watched = property((lambda self: bool(self._observers)))
	def _async_media_update(self):
		if self.wymedia_resource is not None and not self._metadata_handle:
			log.info(self)
			register_update_callback(self.wymedia_resource, self.handle_update)
			get_metadata(self.wymedia_resource)
			self._metadata_handle = True
		return None

	def _update_received(self, infos, kind):
		log.info(self)
		log.debug('%s infos=%s', self, infos)
		try:
			if 'title' in infos:
				if 'i18n' in infos:
					self.name = _(infos['title'])
				else:
					self.name = infos['title'].decode('utf-8')
			self.wymedia_resource.update(infos)

	def media_update(self, *names):
		if self.wymedia_resource is not None:
			wm_resource = None
			if not(names or self.media_update_fields):
				pass
			wanted_attr = names
			if wanted_attr:
				log.debug('%s %s', self, wanted_attr)
				wm_resource = get_object(self['id'], wanted_attr)
				if wm_resource:
					if 'title' in wm_resource:
						if 'i18n' in wm_resource:
							self.name = _(wm_resource['title'])
						else:
							self.name = wm_resource['title'].decode('utf-8')
					index = self.wymedia_resource.get('index', None)
					if index is not None:
						wm_resource['index'] = index
					self.wymedia_resource.update(wm_resource)
		return None

	def __getitem__(self, name):
		try:
			pass
		if self.wymedia_resource is not None:
			if name == 'subtitles':
				return list(WMedia2MMIObjects(get_subtitles(self.wymedia_resource), self.menu, self))
			else:
				if name == 'thumbnail':
					tn = self.wymedia_resource.get('preview')
					if tn is None:
						if hasattr(self.menu, '_thumbnail_updated'):
							self.watch(self.menu._thumbnail_updated)
						else:
							self.async_media_update()
					return tn
			data = self.wymedia_resource[name]
			if name in UNICODE_METADATA_FIELDS:
				return data.decode('utf-8')
			else:
				return data
		else:
			res = self.infos.get(name)
			if callable(res):
				res, self.infos[name] = res(), res()
			return res

	def __setitem__(self, name, value):
		if self.wymedia_resource is not None:
			if name not in ('subtitles', 'thumbnail', 'preview'):
				self.wymedia_resource[name] = value
				log.debug('wymedia.set_metadata(id: %s  %s: %s)', self.wymedia_resource['id'], name, value)
				set_metadata({'id': self.wymedia_resource['id'], name: value})
		else:
			self.infos[name] = value
		return None

	def execute(self, *args, **args):
		try:
			self.player.play(self, *args, **kw)
		except Exception, e:
			PRINT_EXCEPTION(e)

	def __hash__(self):
		if self.wymedia_resource is None:
			return hash(self.name + self.type + self['uri'])
		return hash(self.wymedia_resource['id'])

	def __eq__(self, other):
		if hasattr(other, 'wymedia_resource'):
			if self.wymedia_resource is None or other.wymedia_resource is None:
				return self.name + self.type == other.name + other.type
			return self.wymedia_resource['id'] == other.wymedia_resource['id']
		else:
			if isinstance(other, dict) and 'id' in other:
				return self.wymedia_resource['id'] == other['id']
		return None

	def __ne__(self, other):
		return not self == other

	def __cmp__(self, other):
		if isinstance(other, MediaItem):
			if self.wymedia_resource is None or other.wymedia_resource is None:
				return cmp(self.name + self.type, other.name + other.type)
			return cmp(self.wymedia_resource['id'], other.wymedia_resource['id'])
		else:
			if isinstance(other, dict) and 'id' in other:
				return cmp(self.wymedia_resource['id'], other['id'])
			else:
				return cmp(type(self), type(other))
		return None

	def _npl_decision(self, *args, **args):
		if 'playone' in plugins:
			return self.player.play(self, **kw)
		ms = pygui_globs['menustack']
		ms.back_to_menu(self.menu)
		player = ms.get_player()
		if self.universe == 'multiverse':
			try:
				self.player.play(self, **kw)
			except AttributeError:
				pass
			except:
				PRINT_EXCEPTION()
			return None
		name = self.universe + ':npl'
		if name not in MediaItem.npl_dict:
			wmedia_pls = playlist_create(get_root(), name)
			MediaItem.npl_dict[name] = get_mmi_object(wmedia_pls, self.menu, None)
		pl = MediaItem.npl_dict[name]
		if isinstance(self, GenericContainer):
			item_to_add = self
			item_to_start = None
		else:
			item_to_add = self.parent
			item_to_start = self
		log.debug('NPL: pl=%s to_add=%s to_start=%s', pl, item_to_add, item_to_start)
		if player is None:
			log.debug('NPL: no running player')
			pl.vfs_clear()
			pl.menu = self.menu
			pl.vfs_add_item(item_to_add)
			pl.play(item_to_start, **kw)
		else:
			log.debug('NPL: player found ask for add/replace')
			def _replace():
				pl.vfs_clear()
				pl.vfs_add_item(item_to_add)
				pl.play(item_to_start, **kw)

			def _add():
				if isinstance(self, GenericContainer):
					player.get_item_list('main_list').extend(self.browse())
				else:
					player.get_item_list('main_list').append(self)
				player.song_changed()
				if player.random_mode:
					player.random_mode = False
					player.go_random()

			if self.universe == 'audio':
				from pygui.window import ConfirmWindow, Button
				cw = ConfirmWindow(_('Add to now playing or play this item ?'), buttons=[Button(_('Add'), True), Button(_('Replace'), False)])
				cw.buttons[0].connect(_add)
				cw.buttons[1].connect(_replace)
				cw.show()
			else:
				_replace()
		return None



class DirItem(MediaItem, GenericContainer):
	__doc__ = ' Item representing directory '
	def __init__(self, wymedia_resource, type_='dir', **kw):
		MediaItem.__init__(self, wymedia_resource, type_=type_, **kw)

	def vfs_mkdir(self, name):
		create_container(self.wymedia_resource, name)

	def browse(self, sort_order=None):
		return WindowedItemList(self, menu=self.menu, universe=self.universe, sort_order=sort_order)

	def execute(self):
		self._npl_decision()

	def get_free_child_name(self, prefix):
		if prefix not in self:
			return prefix
		prefix += '-'

	def get_child(self, name, menu=None):
		result_set = container_search(self.wymedia_resource, 'title', name)
		if result_set:
			if len(result_set) > 1:
				log.warn("Query for '%s' returned more than 1 child.", name)
			if not menu:
				pass
			return get_mmi_object(result_set[0], menu, self)
		else:
			raise KeyError("No such child: '%s'" % name)

	def get_child_count(self):
		try:
			return get_child_count(self.wymedia_resource, dict(universe=self.universe))
		except:
			log.warn('%s does not support get_child_count()', self)

	def __contains__(self, name):
		return bool(container_search(self.wymedia_resource, 'title', name))



class Playlist(DirItem):
	__doc__ = ' Playlist object, launch an editor on browse() (see browse_action) '
	def __init__(self, wymedia_resource, type_='playlist', **kw):
		MediaItem.__init__(self, wymedia_resource, type_=type_, **kw)

	def play(self, starts_with=None, **kw):
		log.debug('%s.play(starts_with=%s)', self, starts_with)
		items = self.browse()
		if starts_with is None:
			for it in items:
				if hasattr(it, 'player'):
					it.player.play(it, playlist=items, **kw)
					break
					continue
			else:
				log.info('Nothing to play here')
		else:
			starts_with.player.play(starts_with, playlist=items, **kw)
		return None

	def execute(self):
		from pygui.markerlist import Markerlist
		if self == Markerlist.now_playing:
			log.debug("Can't play Now Playing List !")
		DirItem.execute(self)

	def browse_action(self):
		from pygui.markerlist import Markerlist
		if self == Markerlist.now_playing:
			log.error("Can't edit Now Playing List!")
		if self['mimeType'] == 'audio/mpegurl':
			log.error("Can't edit M3U playlist!")
		if self['backend'] == 'upnp':
			log.error("Can't edit remote playlist!")
		from pygui.menu.menu import PlaylistEditor
		PlaylistEditor(playlist=self, universe=self.menu.universe).show(hide_previous_menu=False)

	def vfs_add_item(self, item):
		if isinstance(item, DirItem):
			from pygui.config import admin_age
			browse_options = dict(universe=self.universe)
			if user_config['security']['parental_control']:
				if not user_config['security']['parent_mode']:
					if not user_config['security']['maturity_rating']:
						pass
					maturity_rating = user_config['security']['maturity_rating']
					browse_options['maturity_rating'] = str(maturity_rating)
				else:
					if user_config['security']['show_hidden']:
						pass
					maturity_rating = 19
					browse_options['maturity_rating'] = str(maturity_rating)
			return playlist_append_container(self.wymedia_resource, item.wymedia_resource, wymedia_sorting, browse_options)
		if isinstance(item, Item):
			return playlist_append_child(self.wymedia_resource, item.wymedia_resource)
		if not isinstance(item, dict):
			return playlist_append_marker_list(self.wymedia_resource, item.wymedia_resource)
		else:
			return playlist_append_child(self.wymedia_resource, item)

	def vfs_clear(self):
		playlist_clear(self.wymedia_resource)

	def vfs_del_item(self, item):
		if isinstance(item, Item):
			item = item.wymedia_resource
		children = container_search(self.wymedia_resource, 'refid', item['id'])
		if not children:
			raise ValueError('Playlist.vfs_del_item(x): x not in playlist')
		object_remove(children[0], {'universe': self.universe})



class RootItem(MediaItem, GenericContainer):
	__doc__ = ' The root item, mother of every item '
	__metaclass__ = MetaSingleton
	parent = property((lambda self: None), (lambda self, val: None))
	def __init__(self):
		from wymedia.wmplus import init
		log.debug('Root::init')
		try:
			init()
		except FreeSpaceCriticalError:
			log.debug('No space left on device')
		log.debug('Root::get')
		egg = get_root()
		self._sort = ['family'] + list(wymedia_sorting)
		MediaItem.__init__(self, egg, type_='root')
		pygui_globs['db_root'] = self

	def browse(self, universe='main', menu=None):
		if universe == 'multiverse':
			options = dict()
		else:
			options = dict(universe=universe)
		log.debug('browsing root...')
		ret = browse_ng(self.wymedia_resource, 0, 100, self._sort, options)
		log.debug('converting result...')
		wm_obj = list(WMedia2MMIObjects(ret, menu, self))
		if 'sysfuck' in plugins:
			wm_obj = list(reversed(wm_obj))
		if 'video' in universe:
			if 'youtube' in plugins:
				wm_obj.append(YouTubeContainer(parent=self, menu=self.menu))
			if 'dailymotion' in plugins:
				wm_obj.append(DailyMotionContainer(parent=self, menu=self.menu))

	def show_menu(self):
		pygui_globs['menustack'].back_one_menu()



class HiddenRoot(DirItem):
	__doc__ = 'The root of all hidden items.\n\n    The HiddenRoot is a VFS structure for things that are saved in the\n    wymedia database but have no physical existence on the hard drive.\n\n    The HiddenRoot is guaranteed to contain the following subcontainers:\n        - TV Favorites\n    '
	__metaclass__ = MetaSingleton
	parent = None
	def __init__(self):
		DirItem.__init__(self, get_root('hidden'), type_='hidden_root')
		for folder in (TV_FAVORITES_FOLDER,):
			if folder not in self:
				log.info('%s not in HiddenRoot. Creating it.', folder)
				self.vfs_mkdir(folder)
				continue

	def browse(self, universe=None, menu=None, sort_order=None):
		return WindowedItemList(self, menu, universe, sort_order=sort_order)



wymedia_sorting = ('container', 'title')
def get_mmi_object(wm_obj, menu, parent):
	display_prefix = menu.type + '_'
	if display_prefix.startswith('marker'):
		display_prefix = display_prefix[6:]
	wm_class = wm_obj['class']

def WMedia2MMIObjects(iterable, menu, parent):
	for i in iterable:
		try:
			yield get_mmi_object(i, menu, parent)
			continue
		except TypeError:
			continue

from .progressive_result import WindowedItemList
from .misc import SubtitleItem
if 'tv' in plugins:
	from .tv import ChannelItem, CaptureChannelItem, ProgramItem, TVRootItem, AllChannelsList
else:
	def ChannelItem():
		return None

	def CaptureChannelItem():
		return None

	def ProgramItem():
		return None

	def TVRootItem():
		return None

	def AllChannelsList():
		return None

from .audiovideo import AudioItem, DVDItem, ImageItem, IsoDVDItem, VideoItem, TVRecordItem
from .audiovideo import YouTubeContainer, DailyMotionContainer, UpnpDirItem, UsbDirItem
from .net import NetDirItem, NetFeedItem, NetItem
wmedia_types = {'object.item.epgItem': ProgramItem, 'object.item.epgItem.dummy': ProgramItem, 'object.item.videoItem.videoBroadcast': ChannelItem, 'object.item.videoItem.videoBroadcast.videoCapture': CaptureChannelItem, 'object.item.videoItem.dvd': DVDItem, 'object.item.videoItem.isoDvd': IsoDVDItem, 'object.item.textItem.subtitle': SubtitleItem, 'object.container.playlistContainer': Playlist, 'object.item.netItem': NetItem, 'object.item.netItem.audio': AudioItem, 'object.item.netItem.video': VideoItem, 'object.item.netItem.image': ImageItem, 'object.item.audioItem': AudioItem, 'object.item.videoItem': VideoItem, 'object.item.videoItem.tvRecord': TVRecordItem, 'object.item.imageItem': ImageItem, 'object.container.netDir': NetDirItem, 'object.container.netFeed': NetFeedItem, 'object.container.storageSystem': DirItem, 'object.container.storageSystem.upnpStorage': UpnpDirItem, 'object.container.storageVolume': UsbDirItem, 'object.container': DirItem, 'object.item': MediaItem}
